Microsoft interview | SDE | Unexpected failure | Answer some of my questions
Round 2 DSA
Questions: The interviewer asked the candidate to implement a Max Heap. The candidate was confused about the definition of "Heapify" and its application. The candidate believed that Heapify is a procedure to create a heap from N elements given at once, taking O(N) time, while the interviewer insisted that Heapify is used to maintain the heap property.
The candidate also referenced a video about Heapify: Heapify is a procedure to create a heap 42:12.
Follow-up Questions:
- Why would I push and that is not required?
- Can you implement heapify first?
Candidate's Approach
The candidate proposed to:
- Use insert to compare with the parent and move elements up.
- Use the heapify algorithm to create the heap if all N elements are given at once.
However, there was a misunderstanding regarding the implementation of Heapify and the candidate's logic was not understood by the interviewer. The candidate attempted to explain their approach but faced confusion and miscommunication throughout the interview.
Interviewer's Feedback
No feedback provided.