📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!

  • google app store apple app store
  • ✖

      Question

      What is a 'linked list' and how does it differ from an

      array?
      A A linked list stores elements contiguously in memory like an array, but with faster access Correct Answer Incorrect Answer
      B A linked list is used only for sorting the elements stored in the nodes; an array is used only for searching operations Correct Answer Incorrect Answer
      C A linked list allows only sequential access; an array allows only random access Correct Answer Incorrect Answer
      D A linked list has fixed size; an array can grow dynamically Correct Answer Incorrect Answer
      E A linked list is a linear data structure where elements are stored at non-contiguous memory locations, each containing data and a pointer to the next node — unlike arrays which store elements in contiguous memory with direct index-based access Correct Answer Incorrect Answer

      Solution

      Array advantages: O(1) random access by index, cache-friendly (contiguous memory), simple implementation. Disadvantages: fixed size (static arrays), expensive insertion/deletion (O(n) shifting). Linked list advantages: dynamic size, O(1) insertion/deletion at head, no wasted memory. Disadvantages: O(n) access (must traverse from head), extra memory for pointers, poor cache locality. Types of Linked Lists are Singly, Doubly, Circular, Doubly Circular linked lists. Linked lists are used in implementing stacks, queues, and hash table chaining.

      Practice Next

      Relevant for Exams:

      ask-question