{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

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

View Full Document Right Arrow Icon
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
Image of page 1

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

View Full Document Right Arrow Icon
called the left child and the right child.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern