Algorithms and Data Structures · Junior · Question 46 of 75
What is a tree in data structures?
- 1An array that is sorted in descending order
- 2Any set of nodes connected by edges, including cycles
- ✓Correct answer: A hierarchy with one root where each node has one parent
Explanation
A tree has no cycles and exactly one path between any two nodes. Examples: the DOM, the file system, a JSON object. A general network of nodes with possible cycles is a graph.