{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# 10-19 notes - 10-19 = for all = there exists Decision trees...

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

10-19 ¥ = for all = there exists Ʒ ¥ Decision trees T for probable P on inputs of size n, Ʒ a corresponding algorithm. ¥ Algorithms for problem P on inputs of size n, Ʒ a corresponding tree T(n) - # of possible outcomes for an input of size in W = branching factor of model’s constant time ops My algorithm for solving problem is model takes Ω(log w t(n)) operations Every comparison sort is Ω(n(log(n)) Input -- An array A of integers between 0…k-1 COUNTINGSORT(A,n,k) For j in 0…k-1 θ(k) Counts(j) 0 For i in 0…n-1 θ(n) Counts(A(i))++ i 0 for j in 0…k-1{ for min in (1…counts(j)){ θ(n+k) A(i) j i++ } } Return A . . θ(n+k) 916 726 3030 314 206 314 713 916 206 counts 1 2 1 1 713 start 0 1 3 4 314 206 314 314 713 916 0 1 2 3 4 Counting sort can be made stable Defn: A sort is stable if any two records w/ same key are in same relative order both before and after sorting Radix Sort - Break up large numbers into d digits - Sort one digit at a time, least significant first, using a stable sort Original 1’s place 10’s place 100’s place

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.

{[ snackBarMessage ]}

### Page1 / 2

10-19 notes - 10-19 = for all = there exists Decision trees...

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

View Full Document
Ask a homework question - tutors are online