Question: There is an array with n integers, but the values are hidden to us. Our goal is to partition the elements into groups based on
There is an array with n integers, but the values are hidden to us. Our goal is to partition the elements into groups based on their values elements in the same group should have the same value, while elements in different groups have different values. The values are hidden to us, but we can probe the array in the following way: we can query a subset of these n elements, and get the number of unique integers in this subset. Design an algorithm to partition these n elements in O(n log n) queries. (Hint: Assume inductively that you have solved the problem over the elements observed so far. Consider how to observe another element.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
