Question: Problem 1 30 pts ((3,4,3) each)]: Analysis of Algorithms For each question, an algorithm will be described that operates on N elements, and your answeir

 Problem 1 30 pts ((3,4,3) each)]: Analysis of Algorithms For each

Problem 1 30 pts ((3,4,3) each)]: Analysis of Algorithms For each question, an algorithm will be described that operates on N elements, and your answeir 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.) iii. For this question, the input is an array where the integers are all 0 or 1, and all the O's come before all the 1's. The task is to find the point where the first 1 occurs. The algorithm to improve is moving down the array from its left end to its right, stopping when the first 1 is encountered. It is possible there are no 1's, and it is possible there are no 0's. Count comparisons (to 0 or 1) Problem 1 30 pts ((3,4,3) each)]: Analysis of Algorithms For each question, an algorithm will be described that operates on N elements, and your answeir 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.) iii. For this question, the input is an array where the integers are all 0 or 1, and all the O's come before all the 1's. The task is to find the point where the first 1 occurs. The algorithm to improve is moving down the array from its left end to its right, stopping when the first 1 is encountered. It is possible there are no 1's, and it is possible there are no 0's. Count comparisons (to 0 or 1)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!