The height of a tree is one more than the height

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: e height of a tree is one more than the height greatest number of ancestors of any node. An element ( call it a node) immediately above node another node is called the parent of those nodes parent immediately immediately below, which are called the children children of the node above. Also called the depth (although that term is often depth (although used just for nodes) used just for nodes). The terms ancestor and descendant are also ancestor descendant used to indicate relative position in the tree. Now that we've got some terms, let's see if we can define what a tree is. It turns out to be a recursive definition. 1 Here is an example of a tree: A tree is defined as follows R • an empty tree, one with no nodes, is a tree L L L subtree • a single node is a tree • the structure formed by taking one or more trees and a single node not in any other tree and making that node the parent of all the roots of the other trees is a tree LL L L L L LL L L One special form of tree is called a binary tree It is a tree with the extra property that a node may not have more than 2 children. These (possible...
View Full Document

This document was uploaded on 04/07/2014.

Ask a homework question - tutors are online