كتاب معالجه PDF
Document Details
Uploaded by RefinedMountRushmore
Mansoura University
د. منی عصمت عبد الحميد عوض
Tags
Summary
This document is a textbook on algorithms, covering topics such as algorithm types, problem definitions, and text processing algorithms. The book is part of the Computer Science program at Mansoura University.
Full Transcript
Input Output algorism algorithm al-Khwarizmi Problem Definitions and Analysis Writing the Algorithm Writing the Program Compilation Ex...
Input Output algorism algorithm al-Khwarizmi Problem Definitions and Analysis Writing the Algorithm Writing the Program Compilation Execution processing time Algorithm Sequence Input Process Z Y X W X=(Z/30) W=X*Y ? W ? X 25 Y 3000 Z 100 X= 3000/30 2500 W=X*25 Output Natural Language Pseudocode. % % Pseudo code 1- Read Total 2- Tax = Total* 10/ 100 3- Health = Total * 2/100 4- NetWage = Total Tax Health 5- print NetWage 6- End Process Flowchart Algorithm's Performance for loop, while ASCII American Standard Code for Information Interchange ASCII ASCII. ASCII Code.. A. " java " : Int j = 106 Int a = 65 Int v = 118 Int a = 65 Sort Algorithm Bubble Sort Algorithm.. ) ( ).... Bubble Sort Algorithm BUBBLESORT(A) 1. fori length[A] 2. do forj length[A] downtoi + 1 3. do if A[j] < A[j 1] 4. then exchange A[j j 1] int list[MAX], i, n, sorted, k, tmp; n = MAX - 1; k = n; sorted=0; while ((k > 0) && (sorted == 0)) { sorted= 1; for (int j = 0;j < k; j++) { if(list[j] > list[j+1]) { tmp = list[j]; list[j] = list[j+1]; list[j+1] = tmp; sorted=0; } } k--; } phases n A {7,4,5,2} ASCII Code H C A Selections Sort Algorithm.... Selections Sort Algorithm Repeat until list is sorted SELECTION-SORT(A) -1 ] if A[ i ] < A[ smallest Example. Sort {5, 1, 12, -5, 16, 2, 12, 14} using selection sort. N A F X C Find & Replace Boyer-Moore Searching. prefix searching. 5 4 Office Word Google.Soundex Searching Hash Table Multiple pattern searching.ClamAV Liner Search Algorithm.X key : (Sequential : X Search) X[i] (X[i] = Key) Key X Key i X[i+1]. X Key : -1 0. n x j A[j] x=4 n=6 j=1 A[j]=x. A[j]=x j=2. A[j]=x j=3. A[j]=x j=4. A[j]=x j=5 Liner Search Algorithm Given a list L of n elements with values or records L0... Ln , and target value T, the following subroutine uses linear search to find the index of the target T in L. 1. Set i to 0. 2. If Li = T, the search terminates successfully; return i. 3. Increase i by 1. 4. If i < n, go to step 2. Otherwise, the search terminates unsuccessfully. "X" Z N C F X A B ASCII Code Binary Search Algorithm. (. (Index). (floor (low + high)) /2. floor floor(-10.3) = -11 floor(100.1) = 100 floor(3.9) = 3 : ( Binary Search Algorithm Input: An array A[1..n] of n elements sorted in nondecreasing order and an element x Output: j if x = A[j]; 1