Recall & Review
beginner
What is a key difference between arrays and linked lists in terms of memory layout?
Arrays store elements in contiguous memory locations, while linked lists store elements in nodes scattered in memory connected by pointers.
Click to reveal answer
beginner
When is it better to use a linked list instead of an array?
Use a linked list when you need frequent insertions and deletions in the middle of the list without shifting elements.
Click to reveal answer
beginner
Why might arrays be preferred over linked lists for accessing elements by index?
Arrays allow direct access to any element by index in constant time, while linked lists require traversal from the start.
Click to reveal answer
intermediate
What is a disadvantage of linked lists compared to arrays regarding memory usage?
Linked lists use extra memory for storing pointers in each node, which arrays do not require.
Click to reveal answer
intermediate
How does resizing differ between arrays and linked lists?
Arrays require creating a new larger array and copying elements when resizing, while linked lists can grow dynamically without copying.
Click to reveal answer
Which data structure allows fast random access to elements?
✗ Incorrect
Arrays store elements contiguously, so accessing by index is fast and direct.
Which data structure is better for frequent insertions and deletions in the middle?
✗ Incorrect
Linked lists can insert or delete nodes without shifting other elements.
What is a downside of linked lists compared to arrays?
✗ Incorrect
Each linked list node stores a pointer, increasing memory overhead.
If you need to access the 1000th element quickly, which is better?
✗ Incorrect
Arrays allow direct access by index, linked lists require traversal.
Which data structure requires copying elements when resizing?
✗ Incorrect
Arrays need to copy elements to a new larger array when resized.
Explain when you would choose a linked list over an array and why.
Think about operations that involve changing the list size often.
You got /4 concepts.
Describe the advantages and disadvantages of arrays compared to linked lists.
Consider access speed and memory usage.
You got /4 concepts.
