cps6-111129

# cps6-111129 - Binary Search 3 7 8 10 13 18 21 22 25 34 37...

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

CompSci 6 Introduction to Computer Science November 29, 2011 Prof. Rodger

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

View Full Document
Announcements • Exam 2 back • Read for next time Chap. 11.1-3 (just the part about selection sort, the first four pages) • Reading Quiz on Blackboard – Due before class next time • Assignment 7 out, due Tues, Dec 6 • One more APT assignment out
What is Computer Science? • The Organization of Data, and Searching CompSci 6 Fall 2011 3

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

View Full Document
Now let’s focus on searching • Linear Search – linear_search1 – linear_search2 – linear_search3 • Compare and time three methods • Binary search – algorithm – Tradeoff – data must be sorted to use

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

View Full Document

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

View Full Document

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

View Full Document

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

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

Unformatted text preview: Binary Search 3 7 8 10 13 18 21 22 25 34 37 42 44 46 49 Binary Search 3 7 8 10 13 18 21 22 25 34 37 42 44 46 49 Thinking about Sorting Jannie Tan • Is sorting important? • Is it a common problem? • In what contexts do you encounter sorting? Selection Sort • Step 1: Find the minimum value • Step 2: Swap it with the value in the first position • Step 3: Keep going until the list is sorted CompSci 100e, Spring2011 8 Selection Sort picks the Smallest! SSS! Correctness • Why is algorithm correct? Efficiency • Is this algorithm efficient? Code • Let's code it!...
View Full Document

## This document was uploaded on 01/17/2012.

### Page1 / 12

cps6-111129 - Binary Search 3 7 8 10 13 18 21 22 25 34 37...

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

View Full Document
Ask a homework question - tutors are online