Copyright © Philip M. Parker, INSEAD. Terms of Use.

| Domain | Definition |
Math | A binary tree where every node's left subtree has values less than the node's value, and every right subtree has values greater. A new node is added as a leaf. (references) |
Source: compiled by the editor from various references; see credits. | |
(From Wikipedia, the free Encyclopedia)
If we write our binary tree nodes as triples (left subtree, node, right subtree), and the null pointer as None, we can build and search them as follows (in Python):
def binary_tree_insert(treenode, value):if treenode is None: return (None, value, None) left, nodevalue, right = treenode if nodevalue > value: return (binary_tree_insert(left, value), nodevalue, right) else: return (left, nodevalue, binary_tree_insert(right, value))def build_binary_tree(values):
tree = None for v in values: tree = binary_tree_insert(tree, v) return treedef search_binary_tree(treenode, value):
if treenode is None: return None # failure left, nodevalue, right = treenode if nodevalue > value: return search_binary_tree(left, value) elif value > nodevalue: return search_binary_tree(right, value) else: return nodevalue
Note that the worst case of this build_binary_tree routine is O(n2) --- if you feed it a sorted list of values, it chains them into a linked list with no left subtrees. For example, build_binary_tree([1, 2, 3, 4, 5]) yields the tree (None, 1, (None, 2, (None, 3, (None, 4, (None, 5, None))))). There are a variety of schemes for overcoming this flaw with simple binary trees.
Once we have a binary tree in this form, a simple inorder traversal can give us the node values in sorted order:
def traverse_binary_tree(treenode):
if treenode is None: return []
else:
left, value, right = treenode
return (traverse_binary_tree(left) + [value] + traverse_binary_tree(right))
So the binary tree sort algorithm is just the following:
def treesort(array):array[:] = traverse_binary_tree(build_binary_tree(array))
There are many types of binary search trees. AVL trees and red-black trees are both forms of self-balancing binary search trees. A B-tree grows from the bottom up as elements are inserted. A splay tree is a self-adjusting binary search tree. In a treap ("tree heap"), each node also holds a priority and the parent node has higher priority than its children.
Types of Binary Search Trees
External Links
Source: adapted by the editor from Wikipedia, the free encyclopedia under a copyleft GNU Free Documentation License (GFDL) from the article "Binary search tree."
Crosswords: BINARY SEARCH TREE |
| Specialty definitions using "BINARY SEARCH TREE": adaptive heap sort, AVL tree ♦ balanced binary search tree ♦ discrete interval encoding tree ♦ height-balanced binary search tree ♦ left rotation ♦ randomized binary search tree, randomized search tree, right rotation ♦ scapegoat tree, splay tree. (references) |
| The following statistics estimate the number of searches per day across the major English-language search engines as identified by various trade publications. Hyperlinks lead to commercial use of the expression at Amazon.com. |
| Expression | Frequency per Day |
binary search tree | 35 |
| Source: compiled by the editor from various references; see credits. | |
Scrabble® Enable2K-Verified Anagrams | |
| Words within the letters "a-a-b-c-e-e-e-h-i-n-r-r-r-s-t-y" | |
-4 letters: trainbearers. | |
-5 letters: aberrancies, brainteaser, carabineers, catarrhines, cranberries, trainbearer, transcriber, treacheries. | |
| Source: compiled by the editor from various references; see credits. SCRABBLE® is a registered trademark. All intellectual property rights in and to the game are owned in the U.S.A and Canada by Hasbro Inc., and throughout the rest of the world by J.W. Spear & Sons Limited of Maidenhead, Berkshire, England, a subsidiary of Mattel Inc. Mattel and Spear are not affiliated with Hasbro. | |
Hexadecimal (or equivalents, 770AD-1900s) (references)42 49 4E 41 52 59      53 45 41 52 43 48      54 52 45 45 |
| Leonardo da Vinci (1452-1519; backwards) (references)
|
Binary Code (1918-1938, probably earlier) (references)01000010 01001001 01001110 01000001 01010010 01011001 00100000 01010011 01000101 01000001 01010010 01000011 01001000 00100000 01010100 01010010 01000101 01000101 |
HTML Code (1990) (references)B I N A R Y   S E A R C H   T R E E |
ISO 10646 (1991-1993) (references)0042 0049 004E 0041 0052 0059      0053 0045 0041 0052 0043 0048      0054 0052 0045 0045 |
Encryption (beginner's substitution cypher): (references)3643483552592533935523742254523939 |
| 1. Crosswords 2. Expressions: Internet 3. Anagrams 4. Orthography | 5. Bibliography |
Copyright © Philip M. Parker, INSEAD. Terms of Use.