Fundamentals of Computer Science II (CSC-152 2000S)


Class 47: Lab: Traversing and Iterating Trees

Back to Implementing Trees. On to Integration Discussion.

Held Wednesday, April 26, 2000

Overview

Today we will explore techinques used to print trees and convert trees to lists.

Notes

Contents

Summary


Required Files

Interfaces:

Implementations:

Utilities:

Traversing Trees

Getting Started

Printing

Modifying printdfs

Modifying printbfs

Printing Edges in Outlines

Using printOutline as a guide, write a method, printWithEdges that includes the edges in the outline. For example, instead of

A
  B
    Q
  E
    T
      X
      Y
      Z
    S
it should print something more like the following
A
+-B
| +-Q
|
+-E
  +-T
  | +-X
  | |
  | +-Y
  | |
  | +-Z
  |
  +-S

Adding a Size and a Depth

Update the interfaces and the implementations to support getSize and getDepth methods. That is, each tree should be able to report on the number of elements it contains and the number of levels it contains.


History

Tuesday, 18 January 2000

Tuesday, 25 April 2000

Wednesday, 26 April 2000

Back to Implementing Trees. On to Integration Discussion.


Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.

This page may be found at http://www.math.grin.edu/~rebelsky/Courses/CS152/2000S/Outlines/outline.47.html

Source text last modified Wed Apr 26 09:55:15 2000.

This page generated on Wed Apr 26 09:57:01 2000 by Siteweaver. Validate this page's HTML.

Contact our webmaster at rebelsky@grinnell.edu