DOC PREVIEW
Princeton COS 226 - Binary Search

This preview shows page 1-2-3 out of 9 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Binary SearchSlide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9821 3 4 65 7 109 11 12 14130641413 25 33 5143 53 8472 93 95 97966Binary SearchloBinary search. Given value and sorted array a[], find index isuch that a[i] = value, or report that no such index exists.Invariant. Algorithm maintains a[lo]  value  a[hi].Ex. Binary search for 33.hiBinary SearchBinary search. Given value and sorted array a[], find index isuch that a[i] = value, or report that no such index exists.Invariant. Algorithm maintains a[lo]  value  a[hi].Ex. Binary search for 33.821 3 4 65 7 109 11 12 14130641413 25 33 5143 53 8472 93 95 97966lohimidBinary SearchBinary search. Given value and sorted array a[], find index isuch that a[i] = value, or report that no such index exists.Invariant. Algorithm maintains a[lo]  value  a[hi].Ex. Binary search for 33.821 3 4 65 7 109 11 12 14130641413 25 33 5143 53 8472 93 95 97966lohiBinary SearchBinary search. Given value and sorted array a[], find index isuch that a[i] = value, or report that no such index exists.Invariant. Algorithm maintains a[lo]  value  a[hi].Ex. Binary search for 33.821 3 4 65 7 109 11 12 14130641413 25 33 5143 53 8472 93 95 97966lomid hiBinary SearchBinary search. Given value and sorted array a[], find index isuch that a[i] = value, or report that no such index exists.Invariant. Algorithm maintains a[lo]  value  a[hi].Ex. Binary search for 33.821 3 4 65 7 109 11 12 14130641413 25 33 5143 53 8472 93 95 97966lo hiBinary SearchBinary search. Given value and sorted array a[], find index isuch that a[i] = value, or report that no such index exists.Invariant. Algorithm maintains a[lo]  value  a[hi].Ex. Binary search for 33.821 3 4 65 7 109 11 12 14130641413 25 33 5143 53 8472 93 95 97966lo himidBinary SearchBinary search. Given value and sorted array a[], find index isuch that a[i] = value, or report that no such index exists.Invariant. Algorithm maintains a[lo]  value  a[hi].Ex. Binary search for 33.821 3 4 65 7 109 11 12 14130641413 25 33 5143 53 8472 93 95 97966lohiBinary SearchBinary search. Given value and sorted array a[], find index isuch that a[i] = value, or report that no such index exists.Invariant. Algorithm maintains a[lo]  value  a[hi].Ex. Binary search for 33.821 3 4 65 7 109 11 12 14130641413 25 33 5143 53 8472 93 95 97966lohimidBinary SearchBinary search. Given value and sorted array a[], find index isuch that a[i] = value, or report that no such index exists.Invariant. Algorithm maintains a[lo]  value  a[hi].Ex. Binary search for 33.821 3 4 65 7 109 11 12 14130641413 25 33 5143 53 8472 93 95


View Full Document

Princeton COS 226 - Binary Search

Documents in this Course
QUICKSORT

QUICKSORT

14 pages

QUICKSORT

QUICKSORT

55 pages

STRINGS

STRINGS

69 pages

Lecture

Lecture

4 pages

STRINGS

STRINGS

18 pages

Hashing

Hashing

7 pages

MERGESORT

MERGESORT

14 pages

Quicksort

Quicksort

12 pages

Strings

Strings

10 pages

Overview

Overview

15 pages

Hashing

Hashing

13 pages

Mergesort

Mergesort

15 pages

Tries

Tries

13 pages

Final

Final

12 pages

Final

Final

12 pages

Mergesort

Mergesort

13 pages

Final

Final

10 pages

Load more
Download Binary Search
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Binary Search and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Binary Search 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?