Question 2 (10 pts) Consider an array A of numbers in R+ such that |A|=n and n is not necessarily a power of 10. Assume that elements of A can be partitioned into k partitions p=[ai,bi], such that the size of each pi is a power of ten, and elements in each pi are uniformly distributed over the unit interval when properly scaled. Can one still use Bucket Sort in linear time? If yes, provide the associated algorithm and explain why it runs in linear time. If no, justify your answer why this cannot happen (is it that no such algorithm can be constructed? or is it that, despite one being able to develop one such algorithm, its run-time cannot be linear)?
Question 3 (10 pts) In this exercise, we wish to investigate whether a multithreaded algorithm can be developed for Counting Sort. In order to assess the feasibility of doing so, one has to examine all the sub-parts of Counting Sort and explain whether or not any of its sub-operations can be run in parallel. We will label three main components of Counting Sort as follows: i. Computing the frequency of each element in A. ii. Computing the rank of each element in A. iii. Using the ranks to position each element of A into B. For each of those components, provide a full justification why it can run in parallel, or why not. In case your answer is yes, develop the full pseudo-code required to multi-thread this part of Counting Sort. In case your answer is no, provide an explanation why parallelism will fail.
F-1