O'Reilly logo

Everyday Data Structures by William Smith

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

Tree structures

Before we begin, we need to detail a few characteristics our tree structure will possess. For starters, we are going to create an ordered tree so we are not going to allow duplicate values to be added, which will simplify our implementation. Also, we are going to restrict each node to two child nodes. Technically this means we are defining a binary tree structure, but for now we are going to ignore the specific advantages and applications of such a structure and examine that definition in more detail later. Next, our structure is going to implement data and children operations by simply exposing the underlying objects contained in each node. We will not be implementing the parent operation because we have no need to traverse the ...

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