@Mannu: Suppose that a[k] = k*k for every even value of k, and the a[k] for odd values of k are such that the conditions of the problem hold; i.e., every value in a[] occurs 1, 2, or 3 times, with only one value occurring 3 times. Then what is your data structure so that the task is O(n)?
Dave On Feb 28, 8:25 am, MANNU <manishkr2...@gmail.com> wrote: > We can use count sort for this. Its intermediate step just tell us the > frequency of each number. > and its complexity is just O(n). -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.