The Gateway to Computer Science Excellence
0 votes
What kind of linked list is best to answer question 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
in Programming by Active (1.2k points) | 189 views

D) because it takes O(1). Rest takes O(n).

Watch this for better understanding

Yes option D because random access is possible with array using indices.

1 Answer

0 votes
Yes for array implementation time would be order(1) but why not answer is double linked list here also to access the last element time would be order(1)  correct  if I am wrong
by Loyal (5.7k points)
since it is not random accessed

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,373 answers
105,285 users