Validate if Tree is BST
📖 Scenario: Imagine you have a family tree where each person has a unique number. You want to check if this tree follows special rules so that it is a Binary Search Tree (BST). In a BST, every left child has a smaller number than its parent, and every right child has a bigger number than its parent.
🎯 Goal: You will build a simple program in Go to check if a given tree is a BST or not. This helps in many computer tasks like searching quickly.
📋 What You'll Learn
Create a tree node structure called
Node with value, left, and right fieldsCreate a sample tree with exact values and structure
Write a function
isBST that checks if the tree is a BSTPrint
true or false based on the check💡 Why This Matters
🌍 Real World
Checking if a tree is a BST is important in databases and search engines to keep data organized for fast searching.
💼 Career
Software developers and data engineers often need to verify tree structures for correctness and efficiency.
Progress0 / 4 steps