Binary Search Tree

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:

    There’s a theory, one I find persuasive, that the quest for knowledge is, at bottom, the search for the answer to the question: “Where was I before I was born.” In the beginning was ... what? Perhaps, in the beginning, there was a curious room, a room like this one, crammed with wonders; and now the room and all it contains are forbidden you, although it was made just for you, had been prepared for you since time began, and you will spend all your life trying to remember it.
    Angela Carter (1940–1992)

    Blessed is the man that walketh not in the counsel of the ungodly,
    nor standeth in the way of sinners, nor sitteth in the seat of the
    scornful.
    But his delight is in the law of the Lord; and in his law doth he
    meditate day and night.
    And he shall be like a tree planted by the rivers of water, that
    bringeth forth his fruit in his season; his leaf also shall not wither;
    and whatsoever he doeth shall prosper.
    Bible: Hebrew Psalm I (l. I, 1–3)