{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

2_BigO

# 2_BigO - CS161 Big O David Kauchak We need a way to talk...

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

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: CS161 - Big O David Kauchak We need a way to talk about that computational cost of an algorithm that focuses on the essential parts and ignores details that are not relavent and that is somewhat agnostic to the underlying hardware. How would you answer the question, what is the running time of algorithm x ? We saw some of this last time in our examination of Insertion-Sort and Merge-Sort . • Asymptotic notation: – Precisely calculating the actual steps is tedious and not generally useful – Different operations take different amounts of time. Even from run to run, things such as caching, etc. will complicate things – Want to identify categories of algorithmic runtimes – Compare different algorithms f 1 ( n ) takes n 2 steps f 2 ( n ) takes 3 n + 100 steps f 3 ( n ) takes 2 n + 1 steps Which algorithm is better? Is the difference between f 2 and f 3 impor- tant/significant? • Runtime examples 1 n n log n n 2 n 3 2 n n ! n = 10 < 1 sec < 1 sec < 1 sec < 1 sec < 1 sec 4 sec n = 30 < 1 sec < 1 sec < 1 sec < 1 sec < 18 min 10 25 years n = 100 < 1 sec < 1 sec 1 sec 1s 10 17 years very long n = 1000 < 1 sec < 1 sec 1 sec 18 min very long very long n = 10 , 000 < 1 sec < 1 sec 2 min 12 days very long very long n = 100 , 000 < 1 sec 2 sec 3 hours 32 years...
View Full Document

{[ snackBarMessage ]}

### Page1 / 5

2_BigO - CS161 Big O David Kauchak We need a way to talk...

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

View Full Document
Ask a homework question - tutors are online