Majority Number: Vikas Sir
3 posters
Majority Number: Vikas Sir
in an array of n element there are n/2 repeated elements ,rest are unique
find the repeated element
can u reduce the time complexity if there are n/2+1 repeated element
find the repeated element
can u reduce the time complexity if there are n/2+1 repeated element
ballu- Posts : 58
Join date : 2009-02-01
in o(nlogn) complexity
just sort the array using any better sorting technique.
check that if mid-1,mid and mid+1 are repeated n/2 or n/2+1 times.
if these no are not the majority number then no number can be majority number.
check that if mid-1,mid and mid+1 are repeated n/2 or n/2+1 times.
if these no are not the majority number then no number can be majority number.
ish.mnnit- Posts : 1
Join date : 2009-02-07
Similar topics
» INFINITY : Vikas Sir
» Output:Vikas Sir
» PAlindrome:Vikas Sir
» Useless Brackets: Vikas Sir
» Binary Search:Vikas Sir
» Output:Vikas Sir
» PAlindrome:Vikas Sir
» Useless Brackets: Vikas Sir
» Binary Search:Vikas Sir
Permissions in this forum:
You cannot reply to topics in this forum
|
|