Level 1: Bronze
A memorized definition. Not wrong, but it stops there.
An array is accessed by index and a linked list is connected by pointers.
3 stars If you are short on time, start with this one.
In one or two sentences
An array sits in contiguous memory and is reached by index. A linked list connects nodes by pointers, so inserting and deleting in the middle is easy.
Say it out loud, or type it below. What you type never leaves this device.
A memorized definition. Not wrong, but it stops there.
An array is accessed by index and a linked list is connected by pointers.
Correct, but too broad or missing context.
An array reaches any element in O(1) but inserting or deleting in the middle shifts later elements, which is O(n). A linked list inserts and deletes in O(1) once you hold the spot, but reaching an element is O(n).
Reaches principle, use and trade-off, with words that invite the next question.
A linked list inserts in O(1) only when you already have the position, and finding it takes O(n). So in practice arrays are often faster. An array is contiguous, fits the cache well and saves pointer space. A dynamic array grows by roughly doubling and copying when full, so appending is O(1) on average. The choice depends on the access pattern and cache effects.
These are likely next questions from an interviewer. Think of your answer first, then press the button.
1 / 3
Why is appending to a dynamic array O(1) on average?
Capacity grows by a factor each time it fills, so the expensive copy is rare. Spread over many appends, the cost per append is constant.
2 / 3
What does a doubly linked list give you?
Each node points both ways, so holding one node lets you move in both directions and delete in O(1). It stores one more pointer.
3 / 3
When is a linked list better than an array?
When middle inserts and deletes are very frequent and you already hold the position, or when moving large elements is costly.
This is a textbook level concept, so no outside source is listed.