{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

demo-bsearch - 8 2 1 3 4 6 5 7 10 9 11 12 14 13 64 14 13 25...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 8 2 1 3 4 6 5 7 10 9 11 12 14 13 64 14 13 25 33 51 43 53 84 72 93 95 97 96 6 Binary Search lo Binary search. Given value and sorted array a , find index i such that a[i] = value , or report that no such index exists. Invariant. Algorithm maintains a[lo] value a[hi]. Ex. Binary search for 33. hi Binary Search Binary search. Given value and sorted array a , find index i such that a[i] = value , or report that no such index exists. Invariant. Algorithm maintains a[lo] value a[hi]. Ex. Binary search for 33. 8 2 1 3 4 6 5 7 10 9 11 12 14 13 64 14 13 25 33 51 43 53 84 72 93 95 97 96 6 lo hi mid Binary Search Binary search. Given value and sorted array a , find index i such that a[i] = value , or report that no such index exists....
View Full Document

{[ snackBarMessage ]}

Page1 / 9

demo-bsearch - 8 2 1 3 4 6 5 7 10 9 11 12 14 13 64 14 13 25...

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

View Full Document Right Arrow Icon bookmark
Ask a homework question - tutors are online