This preview shows pages 1–4. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Outline • Asymptotic Bound – Experimental results • Running Time, Deﬁnitions – Worsttime, averagetime, expectedtime • Running Time Analysis – Loop structures – Recursions (tree structures) 1 Experimental Results Running time Size n O(n) O(n log n) 10 50 100 1k 10k 0.01s 0.03s 100k 0.06s 0.15s 1M 0.74s 1.6s 10M 7.4s 16.5s Solvable size time O(n) 1s 1.4M 1m 81M 1d 117Bil x2 same x2 O(n2) O(2n) 2 weeks 2800 univ. N/A N/A N/A N/A N/A O(2n) 33 39 49 +1 0.27s 26.5s 44.2m 3.1d O(n log n) 720k 34M 35Bil x2− O(n2) 19k 150K 6M x1.4 2 Running Time, Deﬁnitions
• Worst case – T (n) is the longest time of the algorithm running on any input of size n – Deterministic algorithm – Any possible input • Average case (lecture 4) – T (n) is the time of the algorithm running on a randomly generated input of size n – Deterministic algorithm – A random input • Expected case (in lecture 4) – T (n) is the expected time of the algorithm running on any input of size n – Randomized algorithm – Any possible input • (Best case) – Will not be considered, unless explicitly asked 3 Running Time Analysis, Guideline • Loop Structure – Number of nested loops – Number of iterations of each loop – Compute the related series • Recursive Relationship – Map to one of the known relationship – Unbalanced recursive relationship • Consider the running time from the overall picture 4 ...
View
Full
Document
 Spring '09
 ORTIZ
 Recursion

Click to edit the document details