Basic Terminology in Tree Data Structure
Understanding trees in data structures requires knowledge of key terms. Here are the most important ones:
📌 Fundamental Terms:
1️⃣ Node – A single element in a tree containing data and pointers to child nodes.
2️⃣ Root – The topmost node in a tree (the starting point).
3️⃣ Edge – A link between two nodes (parent-child relationship).
4️⃣ Parent Node – A node that has child nodes.
5️⃣ Child Node – A node that descends from another node (parent).
6️⃣ Leaf Node – A node with no children.
7️⃣ Sibling Nodes – Nodes that share the same parent.
📌 Structural Terms:
8️⃣ Degree of a Node – The number of children a node has.
9️⃣ Degree of a Tree – The maximum degree of any node in the tree.
🔟 Depth of a Node – The number of edges from the root to that node.
1️⃣1️⃣ Height of a Node – The number of edges from that node to the deepest leaf.
1️⃣2️⃣ Height of a Tree – The height of the root node (max depth of any node).
1️⃣3️⃣ Subtree – A tree formed by a node and its descendants.
1️⃣4️⃣ Level – The distance (in edges) from the root node. The root is at level 0, its children are at level 1, and so on.
📌 Special Types:
1️⃣5️⃣ Binary Tree – A tree where each node has at most two children.
1️⃣6️⃣ Binary Search Tree (BST) – A binary tree where the left child is smaller and the right child is larger than the parent.
1️⃣7️⃣ Balanced Tree – A tree where the height difference between left and right subtrees is minimal.
No comments:
Post a Comment