@Vamshi: The first answer should be "min heap," not "max heap." The reason 
is that you want to know what the smallest of the ten largest numbers 
you've found so far. So the algorithm is to place the first 10 numbers into 
the min heap. For each additional number x, if x is greater than the root 
of the heap (min element of the current top ten), then replace the root 
with x and re-establish the heap condition. When you are finished with the 
input, the numbers in the heap will be the largest ten numbers in the file.
 
Dave

On Saturday, December 1, 2012 11:54:22 AM UTC-6, vamshi vijay wrote:

> Hi friends....
>
> http://www.iitplacementpapers.com/2012/09/inmobi-previous-placment-papers.html
> -- 
> With Regards,
> N.Vamshi Vijay,
> Mtech,CSE, IIT Kharagpur,
> Software Developer, Amazon India Development Center.
>
>
>  

-- 


Reply via email to