225_11_quickSort

# 225_11_quickSort - 1 Problem of the Day Assume that n= 2 k...

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: 1 Problem of the Day Assume that n= 2 k+1-1. Solve this recurrence using repeated substitution showing all your work: T(n)= (n+1) + 2 T((n-1)/2), T(1)=1. Hint: These are a lot easier to solve if you express the equations in terms of k before starting. For more of a challenge, solve this one: T(n)= n + 2 T((n-1)/2), T(1)=1. 2 Quicksort A well-known sorting algorithm developed by C. A. R. Hoare in 1962 that, on average, makes (nlogn) (big O notation) Θ comparisons to sort n items. However, in the worst case, it makes (n Θ 2 ) comparisons . Typically, quicksort is significantly faster in practice than other (nlogn) algorithms, because its Θ inner loop can be efficiently implemented on most architectures, and in most real-world data, it is possible to make design choices which minimize the probability of requiring quadratic time....
View Full Document

## This note was uploaded on 01/15/2012 for the course CSC 225 taught by Professor Valerieking during the Spring '10 term at University of Victoria.

### Page1 / 8

225_11_quickSort - 1 Problem of the Day Assume that n= 2 k...

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

View Full Document
Ask a homework question - tutors are online