@payal : this will work for only sorted array .... not for unsorted.

On Thu, Feb 9, 2012 at 5:50 PM, payal gupta <[email protected]> wrote:

> http://www.geeksforgeeks.org/archives/4722
> O(logn) soln...
>
> Regards,
> PAYAL GUPTA,
> NIT-B
>
>
> On Thu, Feb 9, 2012 at 5:33 PM, atul anand <[email protected]>wrote:
>
>> ignore my comment...
>>
>>
>> On Thu, Feb 9, 2012 at 4:15 PM, Ashish Goel <[email protected]> wrote:
>>
>>> log n is impossible. the other solution i thought was of building a tree
>>> where each node contains value and its count. and then building a heap out
>>> of these counts, but this will be overkill.
>>>
>>> the fact that rest of the n/2 elements are not unique is the killer in
>>> the logic otherwise only n/2+1 elements are sufficient
>>>
>>> Best Regards
>>> Ashish Goel
>>> "Think positive and find fuel in failure"
>>> +919985813081
>>> +919966006652
>>>
>>>
>>>
>>> On Thu, Feb 9, 2012 at 2:53 PM, atul anand <[email protected]>wrote:
>>>
>>>> i guess can be done using binary indexed tree.
>>>>
>>>>
>>>> On Thu, Feb 9, 2012 at 2:07 PM, Prakhar Jain <[email protected]>wrote:
>>>>
>>>>> But in this post, we don't have prior information about what can be
>>>>> possible majority element.
>>>>>
>>>>> According to my question, we know that either x is the majority
>>>>> element or there is no majority element.
>>>>> Can we use that information to reduce complexity to O(log n)..???
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Algorithm Geeks" group.
>>>>> To post to this group, send email to [email protected].
>>>>> To unsubscribe from this group, send email to
>>>>> [email protected].
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>
>>>>
>>>>  --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Algorithm Geeks" group.
>>>> To post to this group, send email to [email protected].
>>>> To unsubscribe from this group, send email to
>>>> [email protected].
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Algorithm Geeks" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to