Min heap Max heap

We are supposed to find the nearest cars. so we should use min-heap instead of max-heap. shouldn’t we?

Hi!
Yes, to find the nearest cars we should use the MIN Heap, and that’s exactly what Prateek Bhaiya has done in the video. Jump to 18:50, and you can see that Bhaiya has reversed the comparison so that we get the nearest cars instead of the farthest ones.

Thanks.

Hey!
I hope I have resolved your doubt. Please mark it as resolved if you feel satisfied with the explanation.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.