In computer science, a binary search tree (BST), which may sometimes also be called an ordered or sorted binary tree, is a node-based binary tree data structure which has the following properties:
- The left subtree of a node contains only nodes with keys less than the node's key.
- The right subtree of a node contains only nodes with keys greater than the node's key.
- Both the left and right subtrees must also be binary search trees.
- There must be no duplicate nodes.
Generally, the information represented by each node is a record rather than a single data element. However, for sequencing purposes, nodes are compared according to their keys rather than any part of their associated records.
The major advantage of binary search trees over other data structures is that the related sorting algorithms and search algorithms such as in-order traversal can be very efficient.
Binary search trees are a fundamental data structure used to construct more abstract data structures such as sets, multisets, and associative arrays.
Read more about Binary Search Tree: Operations, Types
Famous quotes containing the words search and/or tree:
“Within us, the people of the United States, there is evident a serious and purposeful rekindling of confidence, and I join in the hope that when my time as your President has ended, people might say this about our Nation: That we had remembered the words of Micah and renewed our search for humility, mercy, and justice.”
—Jimmy Carter (James Earl Carter, Jr.)
“The spring is here, young and beautiful as ever, and absolutely shocking in its display of reckless maternity; but the Judas tree will bloom for you on the Bosphorus if you get there in time. No one ever loved the dog-wood and Judas tree as I have done, and it is my one crown of life to be sure that I am going to take them with me to heaven to enjoy real happiness with the Virgin and them.”
—Henry Brooks Adams (18381918)