sorting algorithms
play

Sorting algorithms Ti ings to consider Theory vs Practice Algorithms - PowerPoint PPT Presentation

Sorting algorithms Ti ings to consider Theory vs Practice Algorithms vs Implementations Theoretical best-case performance on worst-case input: n log n Is the algorithm in-place ? Does it use space e ff iciently? Is the algorithm adaptive ? Does


  1. Sorting algorithms Ti ings to consider Theory vs Practice — Algorithms vs Implementations Theoretical best-case performance on worst-case input: n log n Is the algorithm in-place ? Does it use space e ff iciently? Is the algorithm adaptive ? Does it perform well when the data is already sorted? What are we measuring / modeling / optimizing for? comparisons vs swaps • time vs space vs energy vs codability

  2. Results vote here: tinyurl.com/cs42sortdetective

  3. alg. input math closed form asymptotic N − 1 N − 1 sorted N ( N − 1) X X A O ( N 2 ) 1 2 antisorted i =0 j = i +1 selection sort (2) sorted B O ( N log N ) antisorted merge sort (1) sorted C O ( N 2 ) antisorted bubble sort (4) N − 1 X sorted 1 D i =1 N ( N − 1) O ( N 2 ) antisorted insertion sort (3) 2

  4. More fun with sorting More ways to learn about sorting algorithms: • On Wikipedia • Using visualizations • Using sonifications • Using folk-dancification

Recommend


More recommend