>>sorry i forgot to mentioned
>>that array may or may not have a majority element.

If the array may or may not contain the majority element, then after the last step(ie once you get the get the array with one element) , just iterate thru the original array once counting the number of occurences of this element.

Then you 'll know whether its the majority element or no such element exists.


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to