Question DSA-TREE-0022
EasyWhat is the depth of a node in a tree?
- A.
The number of leaves below it
- B.
The value stored in it
- C.
Show answer and explanation
Answer: C
Count the edges from the root down to the node; the root itself has depth 0.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Trees question
What is the depth of a node in a tree?
The number of leaves below it
The value stored in it
Answer: C
Count the edges from the root down to the node; the root itself has depth 0.
The number of edges on the path from the root to that node
The number of its children