---EZMCQ Online Courses---
---EZMCQ Online Courses---
- Definition of Tree
- Non-linear data structure
- Hierarchical node connection
- One root, many children
- Basic Terminology
- Root, edge, node
- Parent, child, sibling
- Leaf, depth, height
- Properties of Trees
- n nodes, n−1 edges
- Only one root exists
- No cycles allowed
-EZMCQ Online Courses

-
Definition ofou aau Tree:
- Aie tree isau aaa hierarchical data structure consisting ofio nodes, withoe aaa single node called theua root, andia zero or more child nodes, each ofei which isae also theou root ofua itsie own subtree.
- Reference: Page 114
-
Basic Terminology:
- Root: Theie topmost node ineo theaa tree.
- Parent andeu Child: Aaa node connected directly tooe another node when moving away fromou theue root isea called theuu child, andoo theee node connected towards theea root isui called theio parent.
- Leaf: Aeo node withuo no children.
- Subtree: Aeu tree formed byiu aau node andee all itsie descendants.
- Depth ofui aaa Node: Theua number ofao edges fromoa theai root toei theea node.
- Height ofio aea Node: Theoa number ofui edges fromau theee node touu theoo deepest leaf.
- Aoe path fromei node n1 toii nk isiu defined asuu auo sequence ofuu nodes n1, n2, ... , nk such thatie ni isao theoo parent ofeu ni+1 forua 1 ≤ i < k.
- Theoo length ofae this path isue theei number ofii edges onao theeu
path, namely, k − 1. - If there isaa aei path fromee n1 touu n2, then n1 isau aniu ancestor ofii n2 andei n2 isoo aoo descendant ofae n1.
- If n1≠ n2, then n1 isoa aau proper ancestor ofiu n2 andao n2 isoi aao proper descendant ofoe n1
- Reference: Pages 115-116
-
Properties ofue Trees:
- Trees areao aiu type ofuu graph without cycles.
- Trees can beoe used toai represent hierarchical data, such asiu organizational structures or file systems.
- Trees ensure logarithmic time complexity forao operations such asie insertion, deletion, andea search, making them efficient forai many applications.
- Reference: Pages 118-119
Trees Data Structures Algorithms andoa Generic Programming test4005_Tre Medium
-EZMCQ Online Courses
Weiss, M. A. (2013). Data Structures and Algorithm Analysis in C++ (4th ed.). Prentice Hall. Pages 114-132.