I only need the answer to question number 4.
3. (5 points) Given a sequence of numbers, S, the mode is the value that appears the most number of times in this sequence. Give an efficient O(nlgn) algorithm to compute the mode for a sequence of n numbers.
4. (5 points) Show that any comparison-based sorting algorithm can be made to be stable, without affecting the asymptotic running time of this algorithm. Hint: Change the way elements are compared with each other.
I only need the answer to question number 4.
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am