Ask your own question, for FREE!
Computer Science 19 Online
OpenStudy (anonymous):

Write a method that removes all duplicates in an array A of N items. Needless to say, your method should be implemented in a class and must use Java 5 generics. It should also return the number of items that remain in A. Your method must run in O(N logN) time (use quicksort as a preprocessing step), and should make no use of the Collections API. An example signature of the method would be public static> int removeDuplicates(T [] array)

OpenStudy (lyrae):

What have you done so far?

OpenStudy (anonymous):

have the recursion (quick sort method ) not yet to understand the the method structure and removing the duplicates help me @lyrae

OpenStudy (rsmith6559):

If you have a sorted array, wouldn't the duplicates be grouped together? So if array[i] == previous, delete array[i] and manage the index.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!