Interview Questions

165. Find max and min in an array with the least number of comparisons

Microsoft Interview Questions and Answers


(Continued from previous question...)

165. Find max and min in an array with the least number of comparisons

Question:
Find max and min in an array with the least number of comparisons


maybe an answer:


get two numbers, compare them;
the bigger one will be compared with max;
the smaller one will be compared with min. O(3n/2)

(Continued on next question...)

Other Interview Questions