@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 sort. 
Once the data is sorted, it is easy to find the unique element.
 

On Friday, May 10, 2013 3:26:13 AM UTC-5, pankaj joshi wrote:

> 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. 
> 0<b<n
>  
> we can implement it by Min Heap(which is based upon the frequency and 
> reorganise itself 
> as the frequency of element change (dynamically)).
>
>
>  
> On Thu, May 9, 2013 at 12:41 AM, MAC <macat...@gmail.com <javascript:>>wrote:
>
>>  sry link was not pasted
>>
>> http://stackoverflow.com/questions/7338070/finding-an-element-in-an-array-where-every-element-is-repeated-odd-number-of-tim
>>  
>> thanks 
>> --mac
>>  
>>
>> On Thu, May 9, 2013 at 12:40 AM, MAC <macat...@gmail.com <javascript:>>wrote:
>>
>>> if one can explin me this i think this problem will get solved 
>>>
>>>
>>> thanks 
>>> --mac
>>>  
>>>
>>> On Wed, May 8, 2013 at 12:02 AM, MAC <macat...@gmail.com 
>>> <javascript:>>wrote:
>>>
>>>>  
>>>> I was asked this in recent amazon onsite interview and asked o write 
>>>> code 
>>>>
>>>> Given an Array of integers . N elements occur k times and one element 
>>>> occurs b times, in other words there are n+1 distinct Elements. Given 
>>>> that 0 < b < k find the element occurring b times.
>>>>  
>>>> We know k is NOT even .
>>>>
>>>>
>>>> thanks 
>>>> --mac
>>>>
>>>
>>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Algorithm Geeks" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to algogeeks+...@googlegroups.com <javascript:>.
>>  
>>  
>>
>
>
>
> -- 
>  Regards,
>
> Pankaj Kumar Joshi 

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.


Reply via email to