This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: 15-121: Introduction to Data StructuresFall 2009Exercise11/13/2009Trees-writtenDue: Fri, Nov 2010:30ambeginning of class Relevant Reading:•Chapter 9.4 of the online text by Eck. Topic: Binary Trees•Chapter 10 of the Lewis and Chase book (up to section 10.4). The rest of Chapter 10 and Chapter 9 are also of interest.Assignment: (worth 5 exercise points) You may work on this exercise in pairs if you wish. Only hand in one copy.1) Consider a Binary Search Tree of animals, where the animals are ordered alphabetically by species name. (I admit that I’m using the term “species name” very loosely, so please don’t sic the bio department on me.) a) Draw a picture of the Binary Search Tree created by the following set of operations: BinarySearchTree t = new BinarySearchTree(); // tree starts out emptyt.insert("aardvark");t.insert("duck");t.insert("dog");t.insert("bird");t.insert("armadillo");t.insert("fish");t.insert("bear");t.insert("deer");t.insert("antelope");t.insert("gazelle");t....
View Full Document
This document was uploaded on 12/19/2009.
- Spring '09
- Data Structures