Command Palette

Search for a command to run...

Week 9 Practice

After reading this week's notes and engaging in the embedded activities and reflections, you should be able to:

  • Understand balance factors and height-balanced trees.
  • Apply single and double rotations to rebalance AVL trees.
  • Trace AVL insertions with automatic rebalancing.
  • Identify which rotations are needed based on balance factor patterns.
  • Set up 1D and 2D DP tables with proper base cases.
  • Formulate recurrence relations from problem structure.
  • Apply DP to optimization problems (maximization, minimization).
  • Solve grid traversal problems using 2D DP.
  • Optimize DP solutions for space complexity.

Please refer to this week's readings to review these concepts and skills.

Practice Problems Overview

This week's practice includes 4 problems covering AVL trees and dynamic programming:

  1. Identifying Required Rotations in AVL Trees - Analyze unbalanced configurations and determine which rotation fixes them
  2. Maximum Subarray Sum (Kadane's Algorithm) - Find the contiguous subarray with maximum sum using 1D DP
  3. Unique Paths in Grid - Count paths in a grid using 2D DP (from Day 40)
  4. Minimum Path Sum - Find minimum-cost path through grid using 2D DP

Key Patterns: The AVL problems test your understanding of tree balancing and rotation mechanics—critical for implementing self-balancing trees. The DP problems build on Days 38-40, applying 1D and 2D DP patterns to classic optimization problems. Together, these problems reinforce Week 9's focus on advanced tree structures and systematic problem-solving with dynamic programming.