Download presentation

Presentation is loading. Please wait.

Published byUlysses Ottey Modified over 2 years ago

1
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

2
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 lo hi mid

3
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 lo hi

4
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 lo midhi

5
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 lohi

6
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 lohimid

7
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 lo hi

8
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 lo hi mid

9
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 lo hi mid

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google