B-Tree, AVL, Red-black, any self balancing tree question TC: low 300's YoE: 1.5
I was asked in Amazon interview. I honestly told him I studied it long time, and there are few cases to left-rotate, right-rotate, and I can give a shot. He smiled and gave me another question. Maybe he was just checking the patience.
BTW It was a hire
Excellent way to gauge whether someone would be an effective software engineer in the real world! /s
Freaking YellowPages guy asked me in an interview! I was desperate at the time because of my H1B status. Fuck him!
Used to be a very common question many years ago. I have been asked ones around both AVL/red black and B trees a few times. It’s no dumber (nor less dumb) than leetcode bullshit of today. Coding interviews have been broken forever.
I did get one of these questions at Google, years and years ago. The interviewer was not happy that I chose to implement the solution in Haskell because it boils down to just listing the balancing conditions and writing a very simple pattern match to handle each one, and you can trivially rely on recursion with no performance issues. They tried to make me go back and do it imperatively to prove I “really understood it” - that was the day I realized tech interviews are just bullshit gatekeeping & hazing, have absolutely nothing whatsoever with assessing skill or fit for the job, just complete frat house initiation nonsense standardized across a whole industry and pretended to be OK.
Wow that is indeed bullshit.
💯