is a widely used data structure that simulates a hierarchical tree structure, with a root value and subtrees of children with a parent node, represented as a set of linked nodes.
Tree
_______ in a tree can have any number of children, compared to a binary tree.
Nodes
A non-linear hierarchical data structure where each node can have any number of children.
Tree (General Tree)
A special type of tree where each node can have at most two children — usually called left and right.
Binary Tree
What are the types of Tree
Ordered Tree
Oriented Tree
Free Tree
is a tree where the order of the children of each node matters. Changing the order of children creates a different tree. Each node’s children are arranged in a specific sequence (left-to-right order).
Ordered Tree
In an ________ tree, the order of each node in the tree is significant.
Ordered Tree
is a tree where the direction of edges is clearly defined — usually from parent to child.
Oriented Tree
Oriented Tree is essentially a directed version of a tree, represented as a _____________
Directed Acyclic Graph (DAG).
it is a tree in which the order of the subtrees of every node in a tree is immaterial / insignificant.
Oriented Tree
is an undirected tree, meaning the edges have no direction.
Free Tree
Free Tree defined as a connected __________
Acyclic Undirected Graph.
has no designated root node and the orientation from a node to any other node is insignificant.
Free Tree
What are the properties of a tree
Number of Nodes and Edges
Root Node
Parent and Child Nodes
Leaf (External) Nodes
Internal Nodes
Degree of a Node
Degree of a Tree
Level (Depth) of a Node
Height of a Tree
Subtree
Path
Ancestor and Descendant Nodes
A tree with NNN nodes always has N−1N - 1N−1 edges. Except the root, each node has exactly one parent, which creates exactly one edge per node.
Number of Nodes and Edges
is the topmost node of the tree. It has no parent and there is exactly one root in a tree.
Root Node
is any node that has one or more children.
Parent
is a node that descends from a parent.
Child Nodes
are nodes with no children.
Leaf (External) Nodes
They are usually located at the bottom level of the tree.
Leaf (External) Nodes
are nodes that are not leaf nodes. They always have at least one child.
Internal Nodes
is the maximum degree among all its nodes.
Degree of a Tree
In a binary tree, the ______ is always less than or
Degree
is its distance from the root.
Level (Depth) of a Node