CSC 3102 Chapter : Trees

12 views5 pages
15 Mar 2019
School
Course
Professor

Document Summary

A tree is a set of nodes in a parent-child relationship. In a binary tree, each node has at most two children: a binary tree is proper if each node has zero or two children. A general linked tree structure defines each node with a value, a reference to a parent, and a sequence of references to children. node *parent(node *v) sequence& children(node *v) bool isroot(node *v) bool isexternal(node *v) We can also recursively traverse a tree, visiting each node in either pre-order or post- order. We can also traverse in depth-first order using a stack, or breadth-first order using a queue. A binary tree is simplified because it does away with the child sequence. struct node. It"s trivially easy to define bool isroot(node *v) bool isexternal(node *v) A note about the textbook"s definition of tree structures: it is very specific in its use of iterators. For example, code fragment 7. 24 in the c++ book (similar to c. f.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents