Question: For each question, an algorithm will be described that operates on N elements, and your answer should include: (a) a big-O expression that describes the
For each question, an algorithm will be described that operates on N elements, and your answer should include: (a) a big-O expression that describes the total number of operations in the worst case (for ex ample, O(N3)) (b) a description of how to achieve the same effect as the algorithm described, but achieved with a better big-O time bound (for example, "use mergesort instead of insertion sort") (c) the big-O time bound for your improved approach Your improved algorithm does not need to be provably the best possible, but it should have a different and better big-O bound. (It may not be as simple as substituting one named algorithm for another; consider what is redundant about the work done by the existing algorithm.) You don't need to use pseudocode to describe your algorithms the style used in the problem descriptions is also sufficient for your solutions. You can use pseudocode if you like. Do not write real code. If you wish to use an algorithm described in class, you can name it and describe how it would be used; no need to copy out its pseudocode i. For each number in an array A of N integers: add that number to every element of array B, which also contains N integers. (Count just the addition operations.) ii. To find the second largest value in an unsorted linked list: mergesort the list, then return the second element from the end. (Count comparisons
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
