Please enable JavaScript.
Coggle requires JavaScript to display documents.
M7 (Since the definition itself divides a binary tree into two smaller…
M7
Since the definition itself divides a binary tree into two smaller structures of
the same type, the left subtree and the right subtree, many problems about binary
trees can be solved by applying the divide-and-conquer technique
-
The most important divide-and-conquer algorithms for binary trees are the
three classic traversals: preorder, inorder, and postorder
-
A tree (more accurately, a free tree) is a connected acyclic graph
A graph that has no cycles but is not necessarily connected is called a forest: each
of its connected components is a tree
Trees have several important properties other graphs do not have. In particular,
the number of edges in a tree is always one less than the number of its
vertices
Rooted Trees Another 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.
A rooted tree
is usually depicted by placing its root on the top (level 0 of the tree), the vertices
adjacent to the root below it (level 1), the vertices two edges apart from the root
still below (level 2), and so on
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
A binary tree is usually implemented for computing purposes by a collection
of nodes corresponding to vertices of the tree. Each node contains some information
associated with the vertex (its name or some value assigned to it) and two
pointers to the nodes representing the left child and right child of the vertex, respectiv
A computer representation of an arbitrary ordered tree can be done by simply
providing a parental vertex with the number of pointers equal to the number of
its children.
-