M
M
MichailNikiforov2016-11-04 17:36:37
Algorithms
MichailNikiforov, 2016-11-04 17:36:37

What is the asymptotic complexity of "arbitrary index access in a doubly linked list"?

Good afternoon!
Tell me what is the asymptotic complexity of the operation "access by an arbitrary index in a doubly linked list" using O-notation.
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2016-11-04
@MichailNikiforov

O(n/2) - you have to go from element to element anyway, but if the index is more than half the length - you can start from the end, and thus go through a maximum of half of the list.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question