subject

Suppose we want to find the 2nd largest and 2nd smallest elements simultaneously for an input of n numbers stored in an array a[1: n]. compare the following strategies in terms of their exact number of comparisons. strategy 1: adapt the two separate for loops idea for minimum and maximum. strategy 2: run mergesort to sort the numbers in ascending or descending order, then output the 2nd ranked and (n-1)th ranked elements. first write each algorithm in pseudocde, then analyze the exact number of comparisons required by the algorithm. note, asymptotic calculations will only get you partial credit for this problem. can you find a better strategy for this problem than the two given? if yes, write the algorithm and analyze the exact number of comparisons required by the algorithm. if not, prove that one of the given strategies is optimal.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 14:30
Norder to receive financial aid at his vocational school, mario must fill out the fafsa. the fafsa is a form that must be completed to determine . in order to complete a fafsa, you must submit . the fafsa can students obtain
Answers: 2
question
Computers and Technology, 24.06.2019 05:30
Hey i really need some solving this problem: 1. encrypt this binary string into cipher text: 110000. include in your answer the formula the decoder would use to decrypt your cipher text in the format (coded answer) x n mod (m) = y & 2. decrypt this cipher text into a binary string: 106 you.
Answers: 2
question
Computers and Technology, 25.06.2019 05:00
Carmina works at a fast-food restaurant. during the slow afternoon hours, carmina always find projects to keep her busy, like washing all the trays or deep-cleaning the drive-thru area. what workplace habit does carmina show by doing this? efficiency initiative interpersonal skills problem solving
Answers: 1
question
Computers and Technology, 25.06.2019 08:10
Memory aids that organize information for encoding are
Answers: 3
You know the right answer?
Suppose we want to find the 2nd largest and 2nd smallest elements simultaneously for an input of n n...
Questions
Questions on the website: 13722361