MasterBy

Interview prep

Learn Binary Trees & Algorithms in 6 weeks

Week by week

Duration
6 weeks
Phases
3
Topics
6
Tasks
14

Goal: Solve binary tree interview problems under time pressure and explain their complexity.

  1. 1. Traversals

    Weeks 1–2

    Depth-first traversal

    • Implement preorder, inorder and postorder recursively
    • Rewrite inorder iteratively with an explicit stack

    Breadth-first traversal

    • Return level-order values as nested arrays
    • Find the right side view of a tree
  2. 2. Binary search trees

    Weeks 3–4

    BST operations

    • Insert, search and delete in a BST
    • Validate a BST with min and max bounds
    • Find the k-th smallest element

    Balanced trees

    • Check whether a tree is height-balanced in O(n)
    • Build a balanced BST from a sorted array
  3. 3. Interview patterns

    Weeks 5–6

    Path and ancestor problems

    • Lowest common ancestor in a binary tree
    • Maximum path sum
    • Serialize and deserialize a tree

    Timed practice

    • Solve four medium problems in 30 minutes each
    • Run one mock interview and review the recording

Be first to know when MasterBy launches

Leave your email — one message at launch, nothing else.