Notes Information
Login / Sign Up to View Document
Sample Document Text
CMSC 132:
Object-Oriented Programming II
Trees & Binary Search Trees
Department of Computer Science
University of Maryland, College Park
Trees
Trees are hierarchical
data structures
One-to-many relationship
between elements
Tree node / element
Contains data
Referred to by only 1
(parent) node
Contains links to any
number of (children)
nodes
Parent node
Children nodes
Trees
Terminology
Root ? node with no parent
Leaf ? all nodes with no children
Interior ? all nodes with children
Root node
Interior nodes
Leaf nodes
Trees
Terminology
Sibling ? node with same parent
Descendent ? children nodes & their descendents
Subtree ? portion of tree that is a tree by itself
? a node and its descendents
Subtree
Siblings
Trees
Terminology
Level ? is a measure of a node's distance from root
Definition of level
If node is the root of the tree, its level is 1
Else, the node's level is 1 + its parent's level
Height (depth) ? max level of any node in tree
Height = 3
Binary Trees
...
Related Documents
Possible Classes Exam
Possible Classes Exam
Possible Classes Exam
Cmsc 132 Quiz Quiz
Problem Description Exam
Factory Pattern Exam
Problem Description Exam
Unauthorized Exam
Binary Search Notes
Network Connections Exam
Simple Rules Exam
Unauthorized Exam
Problem Description Exam
Following Values Exam
Unauthorized Exam
Method Return Quiz
© Copyright 2021 , Koofers, Inc. All rights reserved.
The information provided on this site is protected by U.S. and International copyright law, and other applicable intellectual property laws, including laws covering data access and data compilations. This information is provided exclusively for the personal and academic use of students, instructors and other university personnel. Use of this information for any commercial purpose, or by any commercial entity, is expressly prohibited. This information may not, under any circumstances, be copied, modified, reused, or incorporated into any derivative works or compilations, without the prior written approval of Koofers, Inc.