CMPSC 24 Lecture Notes - Lecture 8: Binary Search Algorithm, Binary Search Tree, Binary Tree

20 views2 pages
School
Course
Professor

Document Summary

A tree has the following general properties: One node is distinguished as a root (node pointer) Every node (exclude a root) is connected by a directed edge from exactly one other node. Leaf node: node that has no children (2, 5, 11, 4) Key: the data that is stored inside a node. Ex: 2 (parent) has a link to 7 and 5 (children) Each node can only be reached through 1 node. Bi-directional access (parent can access children, children can access parent) A: d) a & b; single node tree. Binary tree: a tree where every node can have at most 2 children (designed for fast search) Same operations as a linkedlist or an array. Has a pointer to the left child, right child and parent (optional) For any node, the keys in the node"s left subtree <= node"s key and the keys in a node"s right subtree > node"s key. Has to be true relative to the parent.

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