









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










For a given function g ( n ), we denote by O ( g ( n )) the set of functions O ( g ( n )) = { f ( n ) | there exist positive constants k and n 0 such that 0 ≤ f ( n ) ≤ k · g ( n ) for all n ≥ n 0 }
CPSC 223, 2009 7
CPSC 223, 2009 8 [Carrano, 2007]
CPSC 223 -‐-‐ Fall 2010 10
CPSC 223, 2009 14 Input: A B C D E F G Pick middle: A B C D E F G New input: A B C Pick middle: A B C New input: C Pick middle: C C < D Is C in the List? B < C Found It!
CPSC 223 -‐-‐ Fall 2010 16
CPSC 223, 2009 21 SelecRon Sort Bubble Sort Best Case Average Case Worst Case O ( n^2 ) O ( n^2 ) O ( n^2 ) InserRon Sort Mergesort Quicksort Heapsort Treesort
CPSC 223, 2009 25 SelecRon Sort Bubble Sort Best Case Average Case Worst Case O ( n^2 ) O ( n^2 ) O ( n^2 ) O ( n ) O ( n^2 ) O ( n^2 ) InserRon Sort Quicksort Heapsort Treesort Mergesort
CPSC 223, 2009 27