Question: Given n distinct integers in an array ( you can assume they are distinct for convenience ) , describe an algo - rithm, that can
Given n distinct integers in an array you can assume they are distinct for convenience describe an algo
rithm, that can find both the maximum and minimum integer using at most n comparisons checking
which out of two numbers is bigger is comparision You can also assume n is even. Argue why your
algorithm is correct and why it is guaranteed not to need more than n comparisons. Note that here we
care about the exact number of comparisons, not just an asymptotic bound on them.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
