O'Reilly logo

Introduction to the Art of Programming Using Scala by Mark C. Lewis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 29

Trees

"I think that I shall never see

A poem as lovely as a tree." - Joyce Kilmer

In this chapter you will learn about the concept of a tree as they are known in Computer Science. While we will not be writing poems about them, we will construct some lovely code to provide efficient implementations of some Abstract Data Type (ADT).

29.1 General Trees

Chapter 25 introduced the concept of the linked structure using the simplest form of a linked list. The most general expression of a linked structure is the graph that was briefly presented in chapter 28. A tree is a linked structure that falls somewhere between these two extremes. Like the other two, a tree is formed of nodes with edges between them. We consider these edges to have a direction, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required