DocMCQs Educational Banner

Which of the following points is/are not true about Linked List data structure when it is compared with an array?

Question: Which of the following points is/are not true about Linked List data structure when it is compared with an array?
  • A. a) Random access is not allowed in a typical implementation of Linked Lists
  • B. b) Access of elements in linked list takes less time than compared to arrays βœ“
  • C. c) Arrays have better cache locality that can make them better in terms of performance
  • D. d) It is easy to insert and delete elements in Linked List
Correct Answer: B. b) Access of elements in linked list takes less time than compared to arrays
Explanation: Access of elements in linked list takes less time than compared to arrays is not true.

Explanation:

Arrays provide random access to elements. This means you can directly access any element by its index in constant time (O(1)).

Linked lists provide sequential access to elements. To access a specific element, you need to traverse the list from the beginning, one node at a time. This takes linear time (O(n)), where n is the number of elements in the list.

Therefore, accessing elements in a linked list is generally slower than in an array.

The other options are true:

a) Random access is not allowed in a typical implementation of Linked Lists: This is correct.

c) Arrays have better cache locality that can make them better in terms of performance: This is true due to the way arrays store elements contiguously in memory.

d) It is easy to insert and delete elements in Linked List: This is generally true, especially when compared to arrays, where shifting elements might be required.

Leave a Comment

Your email address will not be published. Required fields are marked *

Join Our WhatsApp Channel ×
Scroll to Top