cps6-111122

cps6-111122 - randomInts.py Time the algorithms Import time...

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

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

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

View Full DocumentRight Arrow Icon
Announcements • Read for next time Chap. 11.1-2 • Reading Quiz on Blackboard soon – Due before class next time • Assignment 6 due Tues, Nov 29
Background image of page 2
Problem – Find the two smallest numbers • Problem in Chapter 10 – search.py • Three different algorithms/approaches to finding the two smallest in a list – Find, Remove, Find – Sort, Identify minimums, get indices – Walk through list keeping track of two smallest so far • Think about how long each step takes • Compares them by timings
Background image of page 3

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

View Full DocumentRight Arrow Icon
To solve the problem • Understand the algorithms – are they correct? • Prepare data
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 DocumentRight 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 DocumentRight Arrow Icon
Background image of page 8
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: randomInts.py Time the algorithms Import time Start = time.time() End = time.time() totalTime = end - start What is Computer Science? The Organization of Data, and Searching CompSci 6 Fall 2011 5 Now lets 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 Binary Search 3 7 8 10 13 18 21 22 25 34 37 42 44 46 49 Welcome Victoria Interrante Associate Professor University of Minnesota Ph.D. UNC-Chapel Hill, 1996 Research in Graphics and Visualization...
View Full Document

This document was uploaded on 01/17/2012.

Page1 / 8

cps6-111122 - randomInts.py Time the algorithms Import time...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online