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 (9.2 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 (4.4 d) (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
Look at this mess the Death Borg made!
Emily Dickinson
Judith Viorst
24
wasabi
Mary I
Service for those Fallen Asleep
The Garden
Diamond
Indian Removal Act
Placozoa
Brace Yourself
perfect number
OPRFHS 1994 death toll
New Writeups
Pavlovna
My Better Half(fiction)
kanoodle
Molson muscle(essay)
aneurin
You pays your money and you takes your choice(idea)
shaogo
July 20, 2008(log)
Glowing Fish
Tualatin River(place)
The Jacket
Words of Advice(idea)
John_Fox
Good Intentions Gone Wrong(person)
Heitah
Posthumous Oscar(thing)
ignis_glaciesque
University of South Florida(place)
ignis_glaciesque
Flogstaskriket(idea)
liveforever
Caesar's last breath(idea)
dagnyswaggart
she wants to believe(personal)
antigravpussy
he doesn't know, but her eyes widen too far(thing)
dagnyswaggart
Wild tides guard her secrets(poetry)
Lord Brawl
Caesar's last breath(poetry)
E2 is a by-product of the existence of The Everything Development Company