Aryan PrajapatKnowledge Contributor
What is binary search tree data structure? What are the applications for binary search trees?
What is binary search tree data structure? What are the applications for binary search trees?
A binary search tree is a data structure that stores items in sorted order. In a binary search tree, each node stores a key and a value. The key is used to access the item and the value is used to determine whether the item is present or not. The key can be any type of value such as an integer, floating point number, character string, or even a combination of these types. The value can be any type of items such as an integer, floating point number, character string, or even a combination of these types. When a node is added to the tree, its key is used to access the item stored at that node. When a node is removed from the tree, its key is used to access the item stored at that node.
A binary search tree is a special type of binary tree that has a specific order of elements in it. It has three basic qualities:
All elements in the left subtree of a node should have a value less than or equal to the parent node’s value, and
All elements in the right subtree of a node should have a value greater than or equal to the parent node’s value.
Both the left and right subtrees must be binary search trees too.