Question: 1 Group Sorting ( 6 7 points ) We say that an array A of size n is k - group sorted if it can
Group Sorting points
We say that an array A of size n is kgroup sorted if it can be divided into k consecutive groups,
each of size nk such that the elements in each group are larger than the elements in earlier groups,
and smaller than elements in later groups. The elements within each group need not be sorted.
For example, the following array is group sorted:
Note that every array is groupsorted, and only sorted arrays are ngroup sorted. For the
rest of this problem we will only care about deterministic algorithms and lower bounds against
deterministic algorithms You may assume that all elements are distinct, and if you want to you
may assume that n and k are powers of
a points Describe an algorithm that kgroupsorts an array in On log kie in at most
On log k time it must turn an array which is not kgroup sorted into one that is Prove
correctness and running time.
b points Prove that any comparisonbased kgroupsorting algorithm requires n log k
comparisons in the worst case.
c points Describe an algorithm that completely sorts an already kgroupsorted array in
On lognk time. Prove correctness and running time.
d points Prove that any comparisonbased algorithm to completely sort an already kgroupsorted array requires n lognk comparisons in the worst case.
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
