Notes 12 - Week 12 Trees Trees are useful Structures for...

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: Week 12: Trees Trees are useful Structures for hierarchies: directory structures, organization charts, family trees, etc. Note: The last few chapters in the text are organized into four modules on trees and one module on graphs. The four modules on trees are: 1. trees in general (this weeks module) 2. binary search trees (bst) 3. heaps 4. balanced trees (especially B-trees) Chapter 25 summarizes trees in general and introduces bst, heaps and B-trees We cover the chapters in the following way: Week 12: Trees (in general) include: some of Chapter 24 Chapter 26 about tree implementations Week 13: bst some of Chapter 25 (about bst) Chapter 27 about bst implementations Week 14: heaps some of Chapter 25 (about heaps) Chapter 28 about heap implementations Week 15: B-Trees Chapter 29 and the final Week 16: Graphs Chapters 30 and 31. First some definitions: A tree is a graph without cycles. A graph is a set of nodes (vertices) and edges (lines) A parent is a node above in hierarchy A child is a node below in hierarchy A leaf is a node with no children An interior node has a parent and a child node Siblings nodes have the same parent The root is the top node The height is the number of levels in a tree. Also the number of nodes along the longest path between the root and leaf. The recursive definition of height: 1 + height of tallest subtree Alternate definition: (see page 644) first level starts at 0 instead of starting at 1 The path length of a node is the number of edges from the root Task 1: Do #1,2 and 3 on pages 643-4 Binary Trees A special case is a binary tree: a tree with at most 2 children at each node called the left child and the right child....
View Full Document

This note was uploaded on 01/23/2012 for the course CS 111C taught by Professor Metzler during the Spring '11 term at City College of San Francisco.

Page1 / 5

Notes 12 - Week 12 Trees Trees are useful Structures for...

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

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