SUNY Geneseo Department of Computer Science


Tree Definitions

{Date}

CSci 240, Spring 2007
Prof. Doug Baldwin

Return to List of Lectures

Previous Lecture

Misc

Return exam 2

Questions?

Tree Introduction

Chapter 13 to but not including Section 13.3.2

Treating trees recursively

            genericTreeAlgorithm( tree )
                if tree is not empty
                    process root
                    for each child
                        genericTreeAlgorithm( child )
                else
                    do base case and return

How could you represent a binary tree in a programming language?

    class BinaryTree<E> {
        private E root;
        private BinaryTree<E> left, right;
        ....
    }

Lab

Hand out Lab 10

Next

Building and searching ordered binary trees

Read Sections 13.3.3 and 13.3.4


Next Lecture