Question: 4. Linear-Time Sorting. In this question, you should make use of the linear-time sorting algorithms that we discussed in class. (a) (2 point) Suppose you
4. Linear-Time Sorting. In this question, you should make use of the linear-time sorting algorithms that we discussed in class. (a) (2 point) Suppose you have n integers ranging from 1 to k and you decided to divide the each integer into d digits. Write down the running time (in -notation) of Radix Sort in terms of n, k and d when sorting these n integers. (b) (5 point) Show how to sort n integers in the range [I.,., n] in O(n) time. (c) (5 points) Describe an algorithm (using pseudocode) that takes a input n integers in the range between 0 and k and an interval i.j] then outputs the number of integers that are in between i and j (inclusive). The algorithm should run in time (n+k)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
