cps6-111129

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

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

View Full Document Right Arrow Icon
CompSci 6 Introduction to Computer Science November 29, 2011 Prof. Rodger
Background image of page 1

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

View Full Document Right Arrow Icon
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
Background image of page 2
What is Computer Science? • The Organization of Data, and Searching CompSci 6 Fall 2011 3
Background image of page 3

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

View Full Document Right Arrow Icon
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
Background image of page 4
Background image of page 5

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

View Full Document Right Arrow Icon
Background image of page 6
Background image of page 7

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

View Full Document Right Arrow Icon
Background image of page 8
Background image of page 9

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

View Full Document Right Arrow Icon
Background image of page 10
Background image of page 11

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

View Full Document Right Arrow Icon
Background image of page 12
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

{[ snackBarMessage ]}

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 Right Arrow Icon
Ask a homework question - tutors are online