What is the main advantage of using linked lists compared to arrays ?

2024

What is the main advantage of using linked lists compared to arrays ?

  1. A.

    Faster random access

  2. B.

    Dynamic size manipulation

  3. C.

    Simpler memory management

  4. D.

    None of these

Attempted by 150 students.

Show answer & explanation

Correct answer: B

Arrays are stored in contiguous memory and provide O(1) random access by index, but resizing an array or inserting in the middle can require moving many elements. A linked list stores elements as separate nodes connected by links, so it can grow and shrink dynamically and insertions or deletions can be done by updating links when the position is known. Therefore, the main advantage of linked lists over arrays is dynamic size manipulation.

Explore the full course: Niacl Ao It Specialist