DEV Community

Somuya Khandelwal
Somuya Khandelwal

Posted on

DAY 65 The Final Chapter: Mastering Binary Search Trees

Hello Everyone!

Today marks the end of my 13-week LeetCode Challenge, and what a journey it has been! It’s fitting that the final day focused on Binary Search Trees, which embody the structured thinking and precision I’ve cultivated over these weeks. Tackling these challenges felt like solving intricate puzzles in a perfectly organized system—a reflection of how far I’ve come.


How the Day Played Out

  1. Search in a Binary Search Tree (Easy Difficulty)

    • Locate a node in a BST and return the subtree rooted at that node.
    • The Strategy:
      • Traversed the tree using the properties of BSTs: moving left or right based on comparisons.
      • Returned the node when the value matched or None if it wasn’t found.
    • The Fun Part:
      • Watching the search narrow down dynamically was satisfying, as if the tree itself was guiding me to the target.
  2. Delete Node in a BST (Medium Difficulty)

    • Delete a node with a specific value in a BST, restructuring the tree to maintain its properties.
    • The Strategy:
      • Used recursion to locate the node and handled three cases:
      • Leaf nodes were simply removed.
      • Nodes with one child were replaced by their child.
      • Nodes with two children were replaced by their in-order successor, ensuring the BST structure remained intact.
    • The Fun Part:
      • Balancing the tree dynamically while ensuring its integrity felt like completing a masterpiece one piece at a time.

What Made Today Special

  1. A Grand Finale:

    • Ending this journey with BSTs—a data structure that demands precision and efficiency—was the perfect conclusion.
  2. Reflecting on Growth:

    • From simple array manipulations to complex tree traversals, today’s problems encapsulated the skills I’ve honed over 13 weeks.
  3. The Satisfaction of Mastery:

    • Successfully solving these challenges reinforced my confidence and highlighted the progress I’ve made.

Key Takeaways

  • BSTs Are About Balance:

    • Problems like Delete Node in a BST emphasize the importance of maintaining structure while solving complex tasks.
  • Precision is Power:

    • Whether searching or modifying, both tasks underscored the value of careful, deliberate operations in hierarchical data.
  • Learning Never Stops:

    • While this challenge ends here, the lessons I’ve learned will continue to guide me in my coding journey.

Reflections

The Search in a Binary Search Tree problem was a satisfying warm-up that demonstrated the elegance of BST traversal, while Delete Node in a BST added depth with its complex restructuring. Together, these tasks were a fitting conclusion to a series that has been as challenging as it was rewarding.


A Journey Completed

Thirteen weeks ago, I set out on this journey to tackle LeetCode challenges systematically, aiming to grow as a problem solver. Along the way, I’ve explored diverse topics—arrays, strings, dynamic programming, graphs, trees, and more. Each week brought new challenges, new learnings, and a deeper appreciation for the art of coding.

This series has been more than just solving problems—it has been a process of growth, resilience, and discovery. I’ve learned to tackle problems with confidence, embrace complexity, and celebrate small victories along the way.


What’s Next?

While this 13-week journey ends today, my coding journey is far from over. I plan to continue solving problems, learning new algorithms, and sharing my experiences. If there’s one thing I’ve learned, it’s that every problem solved is a step toward mastery, and every challenge faced is an opportunity to grow.

To everyone who has followed along, thank you for joining me on this journey. Let’s keep coding, learning, and building together—because the best is yet to come!

Top comments (0)