#!process amazon final
1 messages · Page 1 of 1 (latest)
late Nov, did it early dec, final offer dec 31, scheduled 8th, final 15th
gl
how did the technical go?
tagged?
top k elements
For US nongrad?
us intern
light work
arent you supposed to use a max heap for that
what were the behaviorals
i have mine in 2 hours
nothing wild just like how u deal w deadlines or some shit like that
Wait it doesnt make sense. if you use min heap it is O(n log k) and max heap is O(n + k log n)
if k is similar in size to n. both approaches pretty much equal the same time complexity
but when k is smaller than n. Max heap is still better because k log n is way better than n log k to the point that it gets dominated by n. so doesnt that mean you are comparing n log k to n
where max heap is n and wouldnt that be better
it doesnt matter i think both approaches are really similar time complexity i think you got it in the bag
Min heap is more efficient. Let’s say you wanted to get the top 2 elements. We don’t ever need our heap to have more 2 elements at any time. So if I were to add a 3rd element it’s best to pop whatever is at the top of the heap immediately because it would never fit in within the answer. Because remember the top elements are stored at the bottom of the min heap and the lesser elements are stored at the top.
it should be bucket sort
i think they were talking about the largest ones and not the frequent ones
idk not sure
bruh i got exact same question for my final today @2pm ct
did you use a minheap