Amazon.com Interview Question
1,572 Interview Reviews |
Back to all Amazon.com Interview Questions & Reviews
Interview questions and reviews posted anonymously by interview candidates
Interview Question for Software Engineer at Amazon.com:
How would you build a list of the top 100 largest elements in a file containing millions of integers?
Helpful Question?
Yes |
No
Inappropriate?
Answers & Comments (2)
2 of 2 people found this helpful
First build min heap using 0..100 numbers
As you examine each number in the array
if num > root_of_min_heap [O(1)]
root_of_min_heap = num
siftdown (root_of_min_heap)
Output min_heap as the 100 biggest numbers
Helpful Answer?
Yes |
No
Inappropriate?
To comment on this
question,
Sign In with Facebook or
Sign Up



0 of 0 people found this helpful
by Duy:
Is there any other alternative solution?