A binary tree is made of nodes, where each node contains a “left” pointer, a “right” pointer, and a data element. The “root” pointer points to the topmost node in the tree. The left and right pointers recursively point to smaller “subtrees” on either side.
Stanford CS Education Library: introduces the basic concepts of binary trees, and works through a series of practice problems with solution code in C/C++ and Java. Binary trees have an elegant recursive pointer structure, so they are a good way to learn recursive pointer algorithms.
Basically the tutorial is divided into four basic sections. These sections include Binary Tree Structure, Binary Tree Problems, C Solutions and Java versions of Binary Tree. First section is the introduction of binary trees and the code that operates on them. Binary Tree Problems section contains practice problems in increasing order of difficulty. C Solutions section provides solution code to the problems for C and C++ programmers and Java versions shows how binary trees work in Java, with solution code.
You can find the complete tutorial here. http://cslibrary.stanford.edu/110/BinaryTrees.html
A pdf version is also available here.
Binary Trees (49.7 KiB, 13,301 hits)
This is article #110 in the Stanford CS Education Library. This and other free CS materials are available at the library (http://cslibrary.stanford.edu/). That people seeking education should have the opportunity to find it. This article may be used, reproduced, excerpted, or sold so long as this paragraph is clearly reproduced. Copyright 2000-2001, Nick Parlante, firstname.lastname@example.org.