These possible children are called the left and right

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: ) children are called the left and right child. There is a common diagram used for binary trees, unlike those for more general trees. Some more examples with nodes labelled. a z y d e w f If every node of a binary tree has as many nodes in its left subtree as it has in its right subtree, it is called balanced called balanced. x c b g Another property which binary trees can possess is balance. balance t Usually this means most of the higher nodes in a tree have two children. v r s This is a very desirable feature, as it reduces the height of the tree. 2 We are going to use a binary tree to store information (in the nodes). We started out by saying this was going to lead to good searching and sorting methods. This information can be of any form. Let's see it. The tree doesn't have to be binary, but we will The tree doesn have to be binary but we will discuss discuss this particular tree in the most detail. What makes the tree interesting is the relationship between the contents of nodes and those of their descendants. The contents of any node • comes...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online