i think my concept is right
lets us take array a[1..n];={1,1,1,2,1,3};
n=6;
n/2+1=4;
so take another array aux[];
which is very helpful to findout hw much time each elemnt arrive in a
so its count teh no. of time..
fro i=0 to n
aux[a[i]]++;
so aux now contains aux[]={0,4,1,1,0,0};
and just simply find the maximum which gives the 4 and it is clear 1
comes 4 times and which >n/2+1 ans is majority element
right me if i m wrong ....
Regards
Shashank "Don't b evil U can Earn while u learn"
09166674831
--
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.