BST Search Operation
📖 Scenario: You are working with a simple phone book application that stores contacts in a Binary Search Tree (BST). Each contact has a unique phone number as the key.You want to find if a particular phone number exists in the phone book.
🎯 Goal: Build a program that creates a BST with given phone numbers, sets a target phone number to search, performs the search operation, and prints whether the number is found or not.
📋 What You'll Learn
Create a BST node class with
value, left, and right propertiesManually create a BST with the exact phone numbers: 50, 30, 70, 20, 40, 60, 80
Create a variable
target with the phone number to search: 60Write a function
searchBST that takes the root node and the target value and returns true if found, otherwise falsePrint
Found if the target is in the BST, else print Not Found💡 Why This Matters
🌍 Real World
BSTs are used in phone books, contact lists, and databases to quickly find information by key.
💼 Career
Understanding BST search is important for software engineers working with data storage, search engines, and optimization.
Progress0 / 4 steps