cps6-111122Handout

cps6-111122Handout - Time the algorithms Import time Start...

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

View Full Document Right Arrow Icon
CompSci 6 Introduction to Computer Science November 22, 2011 Prof. Rodger 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 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 To solve the problem • Understand the algorithms – are they correct? • Prepare data – randomInts.py
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 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 / 2

cps6-111122Handout - Time the algorithms Import time Start...

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

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