mockers
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Majority Number: Vikas Sir

3 posters

mockers :: DS :: Array

Go down

Majority Number: Vikas  Sir Empty Majority Number: Vikas Sir

Post  ballu Sun Feb 01, 2009 10:40 pm

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

Posts : 58
Join date : 2009-02-01

Back to top Go down

Majority Number: Vikas  Sir Empty in o(nlogn) complexity

Post  ish.mnnit Fri Feb 13, 2009 2:02 am

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.

ish.mnnit

Posts : 1
Join date : 2009-02-07

Back to top Go down

Majority Number: Vikas  Sir Empty O(n) algorithm

Post  Admin Mon Jun 08, 2009 8:28 pm


Admin
Admin

Posts : 47
Join date : 2009-01-29

https://mockers.forumotion.com

Back to top Go down

Majority Number: Vikas  Sir Empty Re: Majority Number: Vikas Sir

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

mockers :: DS :: Array

 
Permissions in this forum:
You cannot reply to topics in this forum