This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Can only be performed on a sorted list !!! Uses divide and conquer technique to search list Binary Search Algorithm (Cont’d) Search item is compared with middle element of list. If search item < middle element of list, search is restricted to Frst half of the list. If search item > middle element of list, search second half of the list. If search item = middle element, search is complete. Binary Search Algorithm (Cont’d) Determine whether 75 is in the list. Figure 1: Array list with twelve (12) elements Figure 2: Search list, list[0] … list[11] Binary Search Algorithm (Cont’d) Figure 3: Search list, list[6] … list[11] Advantages and Disadvantages Advantages: Solving difcult problem > Example Towers oF Hanoi. Algorithm Efciency –> O(n log n) Parallelism > Shared memory concept Memory access > Efcient use oF memory caches. Disadvantages: Recursion is slow More complicated approach....
View
Full Document
 Spring '14
 blal
 Computer Science, Divide and conquer algorithm, Hanoi, Binary search algorithm

Click to edit the document details