InterviewDryRun
Internship interview

Array vs linked list: when would you use each?

How the interviewer asks it

“Explain the difference between an array and a linked list, and when you would pick each. Then write a function that returns the middle element of a singly linked list.”

Typed drills are free and unlimited: the AI scores your answer against the outline below.

What the interviewer is looking for

  • Memory layout: contiguous block versus nodes linked by pointers.
  • Correct costs: index access O(1) versus O(n); insert at the front O(n) versus O(1).
  • Practical sense: arrays are cache-friendly and usually faster in practice.
  • Working code for the middle node, with the empty-list case handled.

How to structure your answer

  1. 01

    Define both

    One sentence each on how they are stored.

  2. 02

    Compare operations

    Access, search, insert and delete at the front, middle and end.

  3. 03

    When to use

    Arrays for indexed access and iteration; linked lists for frequent inserts and removals when you already hold the node.

  4. 04

    Middle element

    Count the nodes and walk half way, or use a slow and a fast pointer in one pass.

Best answers from candidates

No candidate answers yet. Type yours, and if it scores 6 or more you can show it here without your name.

Answers are shared by candidates, without names, after a privacy check. Add yours

Common mistakes

  • Saying linked lists are always better for inserts without mentioning finding the position.
  • Crashing on an empty list or a single node.
  • Not saying which middle you return for an even length.

Follow-up questions to expect

  • How would you find the middle in a single pass without counting first?
  • How would you detect a loop in a linked list?

Now answer it out loud

Max will ask you this exact question, listen to your answer, push on the weak spots with follow-ups like the ones above, and score you when you finish.

Practice with Max

Free: a 5-minute voice round and unlimited typed drills, with scored feedback. No card, and your camera is never recorded.

More internship interview questions

Preparing for this round? Read hR interview questions for freshers, with sample answers and campus placement interview preparation: a guide for final-year students.