0
0
DSA Typescriptprogramming~5 mins

Tree Terminology Root Leaf Height Depth Level in DSA Typescript - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the root of a tree?
The root is the topmost node of a tree. It has no parent and is the starting point of the tree.
Click to reveal answer
beginner
Define a leaf node in a tree.
A leaf node is a node that has no children. It is at the end of a branch.
Click to reveal answer
intermediate
What does the height of a node represent in a tree?
Height of a node is the number of edges on the longest path from that node down to a leaf.
Click to reveal answer
intermediate
Explain the depth of a node in a tree.
Depth of a node is the number of edges from the root node down to that node.
Click to reveal answer
beginner
What is the level of a node in a tree?
Level of a node is its depth plus one. The root is at level 1, its children at level 2, and so on.
Click to reveal answer
Which node in a tree has no parent?
AChild
BLeaf
CRoot
DSibling
What is true about a leaf node?
AIt has no children
BIt has no parent
CIt is always the root
DIt has at least one child
The height of a node is the number of edges from the node to:
AThe root
BThe deepest leaf below it
CIts parent
DIts sibling
Depth of a node is measured from:
AThe leaf to the root
BThe node to its leaf
CThe node to its sibling
DThe root to the node
If a node is at depth 3, what is its level?
A4
B2
C3
D5
Describe the difference between root, leaf, height, depth, and level in a tree.
Think about where the node is in the tree and how far it is from root or leaves.
You got /5 concepts.
    Explain how you would find the height and depth of a node in a tree.
    Imagine climbing up and down the tree from the node.
    You got /4 concepts.