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

largest and second largest

4 posters

Go down

largest and second largest Empty largest and second largest

Post  mnnit.rahul Tue Feb 03, 2009 3:13 am

find lagest and second largest no in array in minimum no of comparison

mnnit.rahul

Posts : 51
Join date : 2009-02-01

Back to top Go down

largest and second largest Empty Re: largest and second largest

Post  Beagle Tue Feb 03, 2009 10:42 am

Complexity would be O(n+logn)

chk karo do do ke pair mein ki unme se konsa bada hai.
unka alag se set banate jaao. Phir jo number nikle phir unme se chk karo ki konsa bada .. aisa karte karte akhiri mein ek element bachega. wahi largest element hoga.

For second largest. chk karo ki largest waale element ne kisko haraya tha... that would be the second largest element.

Beagle

Posts : 40
Join date : 2009-01-30

Back to top Go down

largest and second largest Empty Re: largest and second largest

Post  mnnit.rahul Tue Feb 03, 2009 11:28 am

there is another method which is better than this

mnnit.rahul

Posts : 51
Join date : 2009-02-01

Back to top Go down

largest and second largest Empty Re: largest and second largest

Post  $corpion Fri Feb 06, 2009 2:40 am

oye bhai ab bata method yaar..
$corpion
$corpion

Posts : 25
Join date : 2009-01-30
Age : 37

Back to top Go down

largest and second largest Empty Re: largest and second largest

Post  Chunks Thu Feb 12, 2009 12:45 am

O(n) se bhi kam me chalega?

Chunks

Posts : 5
Join date : 2009-02-02

Back to top Go down

largest and second largest Empty @etawah

Post  $corpion Tue Feb 17, 2009 12:04 pm

abey sale question dalta hai to atleast replies bhit o dekh liya kar...
batana 0(n) se bhi kam chalega kya
$corpion
$corpion

Posts : 25
Join date : 2009-01-30
Age : 37

Back to top Go down

largest and second largest Empty Re: largest and second largest

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

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