eecs280.discussion.week8

eecs280.discussion.week8 - Week 8 Discussion Binary Search...

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

View Full Document Right Arrow Icon
Week 8 Discussion Binary Search Classes Inheritance
Background image of page 1

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

View Full DocumentRight Arrow Icon
Project 3 and Exams Project 3 due this Wednesday Worth most out of all the projects. Midterm exams will be given back in class. Come to Office Hours or stick around after discussion (if there's time) if you have any questions.
Background image of page 2
Binary Search Given a list of numbers: 5, 10, 3, 15, 20, 9, 7 What is the best way to find any given number?
Background image of page 3

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

View Full DocumentRight Arrow Icon
Binary Search Given a list of numbers: 5, 10, 3, 15, 20, 9, 7 What is the best way to find any given number? Just go through the list, check if the current number is the number, check the next number, etc. ..
Background image of page 4
Binary Search Very slow, especially if you have 1000s of numbers to keep track of. Can anyone think of a better way? (maybe if we sorted the list first?)
Background image of page 5

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

View Full DocumentRight Arrow Icon
Binary Search Binary Search: Requires a sorted list Look at middle element. If current element is less than your target, search next in the right half. If current element is greater than your target, search next in the left half. If current element is your target, hooray! Continue until you find the target. Log2(n) comparisons on average. Since with every comparison you cut the search space in half.
Background image of page 6
Search for 23: 3 5 7 9 10 15 20 23 29 31 3 5 7 9 10 15 20 23 29 31 3 5 7 9 10 15 20 23 29 31 3 5 7 9 10 15 20 23 29 31 3 5 7 9 10 15 20 23 29 31 3 5 7 9 10
Background image of page 7

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

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/14/2010 for the course EECS 280 taught by Professor Noble during the Fall '08 term at University of Michigan.

Page1 / 23

eecs280.discussion.week8 - Week 8 Discussion Binary Search...

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