← Waymo Interview Insights

Waymo·Software Engineer·Onsite - Coding / Algorithms·Senior

SeniorPrefer not to say
Jun 2026

Summary

Waymo SWE interview threw a real curveball: implement a self-balancing BST completely from scratch, no standard library crutches. The kind of question that sounds doable until you're actually staring at rotation logic under pressure.

Questions Asked (1)

Q1

Without using any built-in data structures from the standard library, implement a self-balancing binary search tree (AVL or red-black) from scratch, including your own node definition, rotations, rebalancing, and support for insert, delete, and lookup all in O(log n).

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

I went with AVL because I felt shakier on red-black coloring rules under pressure.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements and choosing AVL for simpler balancing logic. Outline the node structure, then explain each operation (insert, delete, lookup) with rotations and rebalancing, emphasizing O(log n) via height maintenance. Walk through a concrete example to demonstrate correctness.

Pro tip: Mention that you'd write unit tests for edge cases (empty tree, single node, duplicate keys) and use invariants (balance factor, BST property) to verify correctness—this shows production-quality thinking beyond just coding.

1. Clarify and Choose

Confirm constraints (no built-in structures, language choice) and select AVL over red-black for simpler implementation and clearer balancing rules.

2. Define Node and Invariants

Describe the node structure (key, value, left, right, height) and state the AVL invariants: BST property and balance factor in {-1,0,1}.

3. Implement Rotations

Explain left and right rotations, including pointer updates and height recalculations, as the building blocks for rebalancing.

4. Insert and Rebalance

Detail recursive insertion, updating heights on unwind, and applying the four rotation cases (LL, RR, LR, RL) to restore balance.

5. Delete and Lookup

Cover deletion with node replacement (predecessor/successor), rebalancing up the tree, and O(log n) lookup via BST search.

Key Points to Mention

  • Height maintenance and balance factor calculation
  • The four rotation cases (LL, RR, LR, RL) and when to apply them
  • Recursive implementation with height updates on unwind
  • Deletion handling: replacing with predecessor/successor and rebalancing
  • Time complexity proof: tree height is O(log n) due to AVL property
  • Edge cases: empty tree, single node, duplicate keys, and root updates

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.