Explain the search operation on binary tree

Explain the search operation on binary tree

Author: TVA Date of post: 03.07.2017

BST is a collection of nodes arranged in a way where they maintain BST properties. Each node has a key and an associated value.

What is logic gate (AND, OR, XOR, NOT, NAND, NOR and XNOR)? - Definition from edegawiwajy.web.fc2.com

While searching, the desired key is compared to the keys in BST and if found, the associated value is retrieved. We observe that the root node key 27 has all less-valued keys on the left sub-tree and the higher valued keys on the right sub-tree. Whenever an element is to be searched, start searching from the root node. Then if the data is less than the key value, search for the element in the left subtree. Otherwise, search for the element in the right subtree.

Follow the same algorithm for each node.

Java tree data-structure? - Stack Overflow

Whenever an element is to be inserted, first locate its proper location. Start searching from the root node, then if the data is less than the key value, search for the empty location in the left subtree and insert the data.

Otherwise, search for the empty location in the right subtree and insert the data. Home Tutorials Library Coding Ground Tutor Connect Videos Search. Data Structure - Binary Search Tree Advertisements.

explain the search operation on binary tree

Write for us FAQ's Helping Contact.

Rating 4,8 stars - 836 reviews
inserted by FC2 system