cps6-111122

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

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

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

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

View Full Document
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

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

View Full Document
To solve the problem • Understand the algorithms – are they correct? • Prepare data

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: 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
Ask a homework question - tutors are online