# 82134657109111214130 64141325335143538472939597966 Binary Search lo Binary search. Given a key and sorted array a[], find index i such that a[i] = key,

## Presentation on theme: "82134657109111214130 64141325335143538472939597966 Binary Search lo Binary search. Given a key and sorted array a[], find index i such that a[i] = key,"— Presentation transcript:

82134657109111214130 64141325335143538472939597966 Binary Search lo Binary search. Given a key and sorted array a[], find index i such that a[i] = key, or report that no such index exists. Invariant. Algorithm maintains a[lo]  key  a[hi]. Ex. Binary search for 33. hi

Binary Search Binary search. Given a key and sorted array a[], find index i such that a[i] = key, or report that no such index exists. Invariant. Algorithm maintains a[lo]  key  a[hi]. Ex. Binary search for 33. 82134657109111214130 64141325335143538472939597966 lo hi mid

Binary Search Binary search. Given a key and sorted array a[], find index i such that a[i] = key, or report that no such index exists. Invariant. Algorithm maintains a[lo]  key  a[hi]. Ex. Binary search for 33. 82134657109111214130 64141325335143538472939597966 lo hi

Binary Search Binary search. Given a key and sorted array a[], find index i such that a[i] = key, or report that no such index exists. Invariant. Algorithm maintains a[lo]  key  a[hi]. Ex. Binary search for 33. 82134657109111214130 64141325335143538472939597966 lo midhi

Binary Search Binary search. Given a key and sorted array a[], find index i such that a[i] = key, or report that no such index exists. Invariant. Algorithm maintains a[lo]  key  a[hi]. Ex. Binary search for 33. 82134657109111214130 64141325335143538472939597966 lohi

Binary Search Binary search. Given a key and sorted array a[], find index i such that a[i] = key, or report that no such index exists. Invariant. Algorithm maintains a[lo]  key  a[hi]. Ex. Binary search for 33. 82134657109111214130 64141325335143538472939597966 lohimid

Binary Search Binary search. Given a key and sorted array a[], find index i such that a[i] = key, or report that no such index exists. Invariant. Algorithm maintains a[lo]  key  a[hi]. Ex. Binary search for 33. 82134657109111214130 64141325335143538472939597966 lo hi

Binary Search Binary search. Given a key and sorted array a[], find index i such that a[i] = key, or report that no such index exists. Invariant. Algorithm maintains a[lo]  key  a[hi]. Ex. Binary search for 33. 82134657109111214130 64141325335143538472939597966 lo hi mid

Binary Search Binary search. Given a key and sorted array a[], find index i such that a[i] = key, or report that no such index exists. Invariant. Algorithm maintains a[lo]  key  a[hi]. Ex. Binary search for 33. 82134657109111214130 64141325335143538472939597966 lo hi mid

Download ppt "82134657109111214130 64141325335143538472939597966 Binary Search lo Binary search. Given a key and sorted array a[], find index i such that a[i] = key,"

Similar presentations