The Gateway to Computer Science Excellence
0 votes
174 views
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) | 174 views
0

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

Watch this for better understanding

+1
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.6k points)
0
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,647 questions
56,492 answers
195,439 comments
100,694 users