Everything2
Near Matches
Ignore Exact
Full Text
Everything2

binary tree

created by nbaldwin

(thing) by nbaldwin (?) (print)   ?   (I like it!) Sun Nov 14 1999 at 9:06:40

A tree with the property that each node has at most two child nodes (the left child and the right child). Useful in computer science and mathematics. Compare to a binary search tree and graph.

(idea) by st.augustine (8.7 mon) (print)   ?   (I like it!) Wed Jun 28 2000 at 9:09:34

a mathematician picks an integer 'i' from the set {1-16} (integers) and a logician tries to search for the number with yes or no questions. in this particular case, the evil, conniving mathematician can lie once, or not at all, to hinder the logician. a) create a binary tree where, in any situation, the logician can ask seven boolean questions or less and determine the mathematician's number.

(idea) by Noung (12.8 min) (print)   ?   (I like it!) Sat Oct 20 2001 at 13:53:22

A diagram might help illustrate a binary tree, and why it's so darn useful:

                        9
                      /   \
                     /     \
                    6      11
                   / \     / \
                  /   \   /   \
                 2    7  10   15

I'll go through how this comes about.

First, I inserted the value 9. Because it's the first value, it sits all proud at the top. Next comes 6. Because 6 is numerically less than 9, it goes on the left hand side of 9 (this is simply our way of conceptualising the structure. In reality, the top "node" (the name for an object in the tree) has a pointer to this value). Next, I insert 2. The logic process goes like this: 2 is less than 9, hence it wants to be on the left hand side of 9 somewhere. We then move down to 6, and see that 2 is also less than 6, so the value 2 is inserted on the left of 6. Next comes 7, which of course is less than 9, and greater than 6, hence its position (if a value is greater than its parent, it goes on the right in our conceptualisation).

You should now be able to see what happens with the three values to the right of 9.

Binary trees can be implemented for any data that can be greater or less than other bits of data of the same type. For instance, words are sorted lexicographically. Ant is said to be "lexicographically greater" than Zebra.

The true power of binary trees comes in searching them. If the data above was ordered linearly, I could have to scan up to seven values to find the one I want. With it arranged in a binary tree, the most I'll have to search is 3. Imagine what a difference this makes for massive amounts of data.


printable version
chaos

binary search tree B-tree computer science Random Binary Search Tree
abstract data type AVL tree graph Fermat's Last Theorem
genetic algorithm The Psychology of Randomness tree hash table
Binary Space-Partitioning Tree preorder traversal How to remove roommates from showers GOFAI
boolean edge isoperimetric constant prefix Work like you don't need the money
Trie BST disease inorder traversal Quick Sort
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help

Cool Staff Picks
The best nodes of all time:
Everything2 is in direct violation of US Patent No. 6,031,537
models of fictional time travel physics
The Giant Pumpkin Murders
AC-130H/U Gunship
Lews Therin Telamon
The Tesla Coil made me cry, but I got a free lunch out of it.
Lyndon Johnson orders some pants
Median Node-Fu Product
Toussaint L'Ouverture
Lost Gems of Yesteryear
How to fly
King Kong
how to measure the height of a tower with a barometer
New Writeups
tejasa
Cranberry Cornbread(recipe)
Dreamvirus
Brighton Bombing(event)
Ariloulaleelay
'Appendices' to a 'Report' on THE HIVE×BODY MACHŸNE(log)
Timeshredder
WALL-E(review)
sitaraika
Win-laik-pya(idea)
whitelight
The abysmalists(poetry)
Hazelnut
How to solve the obesity epidemic and the oil price hike in one fell swoop(idea)
raincomplex
Spitting out teeth like ampersands(place)
wertperch
July 4, 2008(personal)
Andrew Aguecheek
Keeping In Mind(fiction)
Heitah
The Pit of Life and Death(place)
alyssa-cruz
Spitting out teeth like ampersands(person)
antigravpussy
she is his sounding board(event)
Heitah
Four day work week(idea)
Simulacron3
The Brain and Reality(essay)
E2 is a by-product of the existence of The Everything Development Company