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, 21.06.2019 18:00
Is the following sentence true or false? during meiosis, the two alleles for each gene stay together.
Answers: 3
question
Computers and Technology, 23.06.2019 04:31
Jennifer has to set up a network in a factory with an environment that has a lot of electrical interference. which cable would she prefer to use? jennifer would prefer to use because its metal sheath reduces interference.
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
Plz ( which is an example of a good url?
Answers: 1
question
Computers and Technology, 23.06.2019 15:30
Hey so i was just trying out some game hacks so i took a paste from online and built it in my visual studio and then suddenly my computer was working or clicking on stuff on its own am i hacked?
Answers: 1
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
question
Mathematics, 09.03.2021 21:40
question
Mathematics, 09.03.2021 21:40
Questions on the website: 13722367