Validate if Tree is BST
📖 Scenario: You are working with a simple tree structure used in a small app to store numbers. You want to check if this tree follows the rules of a Binary Search Tree (BST).A BST is a tree where for every node, all values in the left subtree are smaller, and all values in the right subtree are larger.
🎯 Goal: Build a TypeScript program that creates a tree, sets up helper variables, writes a function to check if the tree is a BST, and prints the result.
📋 What You'll Learn
Create a tree using a Node class with
value, left, and right propertiesAdd a helper function to check if the tree is a BST
Use recursion to validate BST properties
Print
true if the tree is a BST, otherwise false💡 Why This Matters
🌍 Real World
Binary Search Trees are used in databases and search engines to quickly find data.
💼 Career
Understanding BST validation helps in roles involving data structures, algorithms, and software development.
Progress0 / 4 steps