+1 vote
in Data Structures & Algorithms I by (110k points)
What kind of linked list is best to answer questions like “What is the item at position n?”

(a) Singly linked list

(b) Doubly linked list

(c) Circular linked list

(d) Array implementation of linked list

My question is from Singly Linked List Operations in section Abstract Data Types of Data Structures & Algorithms I

I had been asked this question in an online interview.

1 Answer

+1 vote
by (550k points)
Right option is (d) Array implementation of linked list

To explain: Arrays provide random access to elements by providing the index value within square brackets. In the linked list, we need to traverse through each element until we reach the nth position. Time taken to access an element represented in arrays is less than the singly, doubly and circular linked lists. Thus, array implementation is used to access the item at the position n.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.