Question:

The elements of linked list are stored

Show Hint

Think of an array as a row of houses on a street (contiguous). Think of a linked list as a treasure hunt where each clue (node) tells you where to find the next clue.
  • in a structure
  • in an array
  • anywhere in the disk
  • in continuous memory location
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is A

Solution and Explanation

Step 1: Understand the structure of a linked list. A linked list consists of nodes. Each node typically contains two parts:

The data element.
A pointer (or link) to the next node in the sequence.
This node is often implemented as a `struct` or a `class`.
Step 2: Analyze the storage mechanism. Unlike an array, the nodes of a linked list are not required to be in contiguous (side-by-side) memory locations. The pointer in each node tells the program where to find the next element, which can be located anywhere in memory.

(A) The elements are stored in nodes, which are typically defined using a `structure` (or class). This is the best fit among the options.
(B) and (D) are incorrect; this describes an array.
(C) is incorrect; linked lists are stored in main memory (RAM), not directly on the disk.
The elements are stored in nodes (structures) which can be scattered throughout memory.
Was this answer helpful?
0
0