10. Trees - MATH 224 Discrete Mathematics Rooted Trees A...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
8/27/09 11 MATH 224 – Discrete Mathematics A rooted tree is a tree that has a distinguished node called the root. Just as with all trees a rooted tree is acyclic (no cycles) and connected. Rooted trees have many applications in computer science, for example the binary search tree. Rooted Trees The root is typically drawn at the top. Children of the root. Grandchildren of the root and leaf nodes.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
8/27/09 22 MATH 224 – Discrete Mathematics A Binary tree is a rooted tree where no node has more than two children. As shown in the previous slide all nodes, except for leaf nodes, have children and some have grandchildren. All nodes except the root have a parent and some have a grandparent and ancestors. A node has at most one parent and at most one grandparent. Rooted Binary Trees The root of a binary tree at level 4 also height 4 and depth 0. Nodes with only 1 child at level 2 and depth 2. Nodes a level 1, and depth 3. Nodes at level 3 and depth 1. Nodes with no children are called leaf nodes. Nodes a level 0, and depth 4.
Background image of page 2
8/27/09 33 MATH 224 – Discrete Mathematics A Balanced tree
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

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

{[ snackBarMessage ]}

Page1 / 12

10. Trees - MATH 224 Discrete Mathematics Rooted Trees A...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online