{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Map Hash Tables and Dictionaries_Part_13

# Map Hash Tables and Dictionaries_Part_13 - Boundary...

This preview shows pages 1–5. Sign up to view the full content.

Last Updated: 06/02/12 10:23 PM CSE 2011 Prof. J. Elder - 61 - 25 13 74 Boundary Conditions key 25 95 91 88 83 72 60 53 51 49 43 36 21 21 18 6 5 3 If key mid , then key is in left half. If key > mid , then key is in right half. •Another bug! No progress toward goal: Loops Forever! mid Select mid 2 p q + =

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Last Updated: 06/02/12 10:23 PM CSE 2011 Prof. J. Elder - 62 - if [ mid ] 2 1 else end key A mi p q q mid p mid d + = = + = Boundary Conditions if [ mid ] 2 1 else end key A mi p q q mid p mid d + = = + = if < [ mid 2 1 ] else end key A mid p q q mid p mid + = = = OK OK Not OK!!
Last Updated: 06/02/12 10:23 PM CSE 2011 Prof. J. Elder - 63 - if [ mid ] 2 1 else end key A mi p q q mid p mid d + = = + = How Many Possible Algorithms? mid r 2 o ? p q + = if < [ or ? ] key A mid else o end 1 r q mid p mid = =

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Last Updated: 06/02/12 10:23 PM CSE 2011 Prof. J. Elder - 64 - <precondition>: A[1..n] is sorted in non-decreasing order <postcondition>: If is in A[1..n], algorithm returns 1, its location loop-invariant>: If
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 5

Map Hash Tables and Dictionaries_Part_13 - Boundary...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online