Recall & Review
beginner
Why do we need trees when we already have arrays and linked lists?
Trees help organize data in a way that allows fast searching, insertion, and deletion in hierarchical relationships, which arrays and linked lists cannot do efficiently.
Click to reveal answer
beginner
What is a key limitation of arrays compared to trees?
Arrays have fixed size and slow insertion/deletion in the middle, while trees can grow dynamically and allow faster updates in hierarchical data.
Click to reveal answer
beginner
Why can't linked lists efficiently represent hierarchical data?
Linked lists are linear and only connect elements in a sequence, so they cannot naturally represent parent-child relationships like trees do.
Click to reveal answer
intermediate
How do trees improve search operations compared to arrays and linked lists?
Trees like binary search trees allow searching in O(log n) time by dividing data into branches, while arrays and linked lists require O(n) time for search.
Click to reveal answer
beginner
What real-life example helps explain why trees are useful?
A family tree shows relationships between people in generations, which arrays or linked lists cannot represent well because they are linear, not hierarchical.
Click to reveal answer
Which data structure is best for representing hierarchical data?
✗ Incorrect
Trees naturally represent hierarchical relationships with parent and child nodes.
What is a main disadvantage of arrays compared to trees?
✗ Incorrect
Arrays have fixed size and inserting in the middle requires shifting elements, which is slow.
Why can't linked lists efficiently represent parent-child relationships?
✗ Incorrect
Linked lists connect elements one after another, so they can't show hierarchical links.
Which operation is faster in trees than in arrays or linked lists?
✗ Incorrect
Trees can search in O(log n) time by branching, while arrays and linked lists take O(n).
What real-world structure is similar to a tree data structure?
✗ Incorrect
A family tree shows hierarchical relationships like a tree data structure.
Explain why trees are needed when arrays and linked lists exist. Include examples of what trees can do better.
Think about how data is connected in real life, not just in a line.
You got /4 concepts.
Describe the limitations of arrays and linked lists that trees solve.
Focus on structure and operation speed.
You got /4 concepts.