Re: [algogeeks] Re: Array of intergers with repeating elements

2013-05-10 Thread pankaj joshi
Hi, we can calculate the frequency of all element, Assign sort them in increasing order of frequency. then the first element of sorted list will be the return element. 0bn we can implement it by Min Heap(which is based upon the frequency and reorganise itself as the frequency of element change

Re: [algogeeks] Re: Array of intergers with repeating elements

2013-05-10 Thread Dave
@Pankaj: Can you give more details of your algorithm, including the big-O order of time and space. It certainly is not difficult to do it in O(n log n) time and O(n) space, as this can be accomplished by a merge-sort. For fixed data size, O(n) time and O(n) space can be achieved by a radix