Question: One common data processing task is deduplication: taking an array containing values and removing all the duplicate elements. There exist a wide range of different

One common data processing task is deduplication: taking an array containing values and removing all the duplicate elements. There exist a wide range of different algorithms for completing this task efficiently. Assume that the array of n values, A, you are using supports three operations,
get(A, i): Returns the value of the ith element of the array A
search(A, i): Searches the array A for all elements at indexes larger than i that are the same as the element at index i using a linear search and returns the indexes as a list.
delete(A, i): Deletes the element at index i from the array by shifting all elements at index i+1 to n-1 backwards by one.
You may assume that get, as well as the comparison between two elements of the array, require constant time, and that search and delete require linear time. You may assume that the maximum size of the output array of search is a small constant, and so the space and time costs of handling it can be neglected.
(5 pts) Propose an algorithm for performing deduplication of an array of elements in place with
space complexity and
worst-case time complexity. Prove both the correctness of this algorithm, and its time and space complexity bounds.
(5 pts) Deduplication can be made more efficient by using additional memory. Next, propose an algorithm for performing deduplication with
time complexity, and
space complexity. You may use an auxiliary array that supports assignment, but do not use any other data structures and do not sort the data. Prove both the correctness and the time and space complexity bounds of this new algorithm.
(5 pts) The UNIX core utilities include a program called uniq, which can perform deduplication on an input stream in linear time, assuming the data is sorted. Given this assumption, propose a new deduplication algorithm that requires
space and time. Prove its correctness.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!