Please enable JavaScript.
Coggle requires JavaScript to display documents.
Trees - Coggle Diagram
Trees
Definitions
A tree (more accurately, a free tree) is a connected acyclic graph.
-
Parent and Child
If (u, v) is the last edge of the simple path from the
root to vertex v (and u != v), u is said to be the parent of v and v is called a child of u
-
Subtree
All the descendants of a vertex v with all the edges connecting them form the subtree of T rooted at that vertex
-
-
-
Rooted Trees
A very important property of trees is the fact that for every two vertices in a tree, there always exists exactly one simple path from one of these
vertices to the other. This property makes it possible to select an arbitrary vertex
in a free tree and consider it as the root of the so-called rooted tree.
-
Ordered Trees
-
Binary Tree
A binary tree can be defined as an ordered tree in which every vertex has no more than two children and each child is designtaed as either a left child or a right child of its parent. A binary tree may also be empty
Traversals
All three traversals visit nodes of a binary tree recursively by visiting the tree’s root and its left and right subtrees
-
-
-
Binary Search Tree
-
A binary search tree (BST), also called an ordered or sorted binary tree, is a rooted binary tree whose internal nodes each store a key greater than all the keys in the node's left subtree and less than those in its right subtree
Height
It can be computed as the maximum of the heights of the root’s left and right subtrees plus 1 (We have to add 1 to account for the exttra level of the root). Is also convenient to define the height of the empty tree as -1
-
-