【正文】
al distribution of inputs. Bestcase: (bogus) ? Cheat with a slow algorithm that works fast on some input. Kinds of analyses Worstcase: (usually) Bestcase: (bogus) 25 6 7 5 6 71 2 4 8 2 4 5 8( ) ( ) ( ) ( )2 2 2 2 2 2c c c c c cT n n c c c c n c c c c? ? ? ? ? ? ? ? ? ? ? ? ? ?1 2 4 5 8 2 4 5 8( ) ( ) ( )T n c c c c c n c c c c? ? ? ? ? ? ? ? ?Worstcase and averagecase analysis Designing algorithms The divideandconquer approach The divideandconquer approach Example Merge Machineindependent time What is insertion sort’s worstcase time? ? It depends on the speed of our puter: ? relative speed (on the same machine), ? absolute speed (on different machines). BIG IDEA: ? Ignore machinedependent constants. ? Look at growth of T(n) as n → ∞ . “Asymptotic Analysis”.