Lecture12-quicksortavg-matrixmult

# 1 n quicksort average case analysis 1 2 1 n k t n t k

• Notes
• 33

This preview shows page 8 - 14 out of 33 pages.

1) n -

Subscribe to view the full document.

Quicksort: Average Case Analysis 1 0 2 ( ) ( ) ( 1) n k t n t k n n - = = + - [ ] 2 ( ) (0) ... ( 2) ( 1) ( 1) t n t t n t n n n = + + - + - + - [ ] 2 ( 1) (0) ... ( 2) ( 2) 1 t n t t n n n - = + + - + - - [ ] 1 2 ( 1)( 2) ( 1) (0) ... ( 2) n n n t n t t n n n n - - - - = + + - + 1 2 ( 1)( 2) ( ) ( 1) ( 1) ( 1) n n n t n t n t n n n n n - - - - - = - + - - 1 2 ( 1) ( 1)( 2) ( ) ( 1) n n n n n t n t n n n n - - - - - - + - = ÷
Quicksort: Average Case Analysis 1 2( 1) ( ) ( 1) n n t n t n n n + - - - = 1 2 2( 1) ( ) ( 1) n n t n t n n n n - - - + - = ÷ 1 2 ( 1) ( 1)( 2) ( ) ( 1) n n n n n t n t n n n n - - - - - - + - = ÷

Subscribe to view the full document.

Quicksort: Average Case Analysis 1 2( 1) ( ) ( 1) n n t n t n n n + - - - = ( ) ( 1) 2( 1) 1 ( 1) t n t n n n n n n - - - = + + ( ) Let ( ) 1 t n y n n = + 2( 1) ( ) ( 1) ( 1) n y n y n n n - = - + + 1 2( 1) ( ) ( 1) n i i y n i i = - = + 1 1 as , ( ) 2 2ln ( 1) n i n y n n i = → ∞ + ( ) ( 1) ( ) 2( 1)ln ( log ) t n n y n n n O n n = + +
Summary: Average Case Analysis § We have walked through the process for conducting an average case analysis: § Characterize your input § Sample space § Probability Distribution § Measure § Define your random variable: average running time of algorithm § Compute the expected value of this RV § Algebra § Requires cleverness with recurrence relations! § Asymptotic Order of Growth

Subscribe to view the full document.

Fair Game? § You could pick this proof for the proof project and fill in the blanks § If you do so, include a section that lays out the high-level method for doing average case analysis in general!
You've reached the end of this preview.
• Spring '08
• Jones,M
• Probability theory, Divide and conquer algorithm, average case

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern