S 310: Worksheet 03 5. After developing a specialized search algorithm, young An
ID: 3753771 • Letter: S
Question
S 310: Worksheet 03 5. After developing a specialized search algorithm, young Anakin rushed into e a limited sample size of n - 100 people, the search took I hour. After a d of the results, however, he noticed th quick check e test only included the men in the original dath. e corrected this mistake and included the women and children in the test, the sample increased to n 1000. Answer the following prompts. (a) (3 points) Predict, as accurately as possible, the maximum duration the algorithm wi take with the new sample size if the algorithm's complexity is O(n2). (b) (2 points) How long the algorithm will take if the algorithm is O(n!). ContinuedExplanation / Answer
Since it's explicitly mentioned that the tests are empirical, a simple elementary unitary method would help us with the maths required.
(a)100 peoples -> 1 hr for O(n^2) Complexity.
=> Let's break it down for n = 100, n^2 = 10000 -> 1 hr
=> So for, n = 1000, n^2 = 1000000 = 10000 * 100 -> (1 * 100) hr
=> Hence it would take 100 hr for the sort to execute to completion (Max.).
(b) 100 peoples -> 1 hr for O(n!) Complexity.
=> Let's break it down for n = 100, n! = 100! -> 1 hr
=> So for, n = 1000, n! = 1000! = 100! * 101 * 102 * ... * 1000 -> (1 * 101 * 102 * ... * 1000) hr
=> Hence you may safely assume it is going to take centuries for it to execute to completion.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.