Jump to page content Jump to navigation

College Board

AP Central

APAC 2008 Call for Proposals
AP Course Audit Web Site
Become an AP Reader
Click for more information about College Board Online Events

Print Page
Home > AP Courses and Exams > Course Home Pages > Teaching Binary Trees

Teaching Binary Trees

We all love to be creative in our class presentations, especially when we are sure that the topic being presented is new to the majority of our students. "Binary trees" is often one of those topics. In addition to the ideas that our colleagues present, there are many links that provide animations of binary trees.

Teaching Binary Trees
Contributed by Leigh Ann Sudol
Fox Lane High School
Bedford, New York


Objective: To provide students with a visual representation of the creation of a binary tree, to traverse the tree visually, and to add nodes to a tree.

Materials: Students will need a small stack of Post-it® brand notes (you can divide a regular stack between 5 or 6 groups easily) and a space to work (tables, wall, chalkboard, etc.).

Procedure: Divide the class into groups of two students. Each group is to play the following game:

One student is to think of two things (dog/cat, house/barn, etc.) and a question that answers as yes for one of the objects and no for the other. (For example, for dog and cat: Does it bark? yes=dog, no=cat)

The other student thinks of a person or thing (does not have to be one of the items, but can be). The first student is to use the question tree to try and guess the item that the second person is thinking of. If the player reaches a leaf note and it is not his item he or she is to give a question that would be yes for one item but no for another item. At that point the Post-it notes are rearranged, inserting the new item, and the game is played again.
Once students have played the game enough to be comfortable with it they write directions for how to build the Post-it note tree as well as how to search for a correct answer to someone else's guess.

The Post-it notes provide a visual representation of the question tree. Students are usually able to write the code for a program after playing the game. The game also provides an excellent resource for tracing problematic code. Post-it notes can also be used for tracing other dynamic data structures, such as linked lists.

Useful Tree Links
Contributed Anonymously

Visualization helps many students understand difficult concepts. One method of visualizing tree operations is to actually watch these operations in action! The following Web links provide animations or applications involving trees. Enjoy!

Binary Tree
This very simple binary tree animation allows you to insert and delete nodes with integer values and search for a specific integer value in the tree.
  Binary Tree

Binary Tree Traversals
Watch your favorite traversal through a binary tree OR test yourself on the different binary tree traversals.
  Binary Tree Traversals

Heaps
In this animation, both the array representation (used in the implementation of the algorithm) and the (logical) tree representation are shown. This is to demonstrate how the tree is restructured to make a heap again after every insertion or deletion.
  Heaps

Contribute
If you would like to contribute other suggestions for teaching binary trees, please submit your ideas.


  MY AP CENTRAL
    Course and Email Newsletter Preferences
  AP COURSES AND EXAMS
    Course Home Pages
    Course Descriptions
    The Course Audit
    Sample Syllabi
    Teachers' Resources
    Exam Calendar and Fees
    Exam Questions
    AP Credit Policy Information
  PRE-AP
    Teachers' Corner
    Publications
  AP COMMUNITY
    About Electronic Discussion Groups
    Become an AP Exam Reader

Back to top