Sobes.tech
Middle+

What is the search speed in LinkedList (average and worst case)?

sobes.tech AI

Answer from AI

In a LinkedList, the search for an element by value has a complexity:

  • Average time: O(n), since it requires traversing the list elements until the desired one is found.
  • Worst-case time: O(n), when the element is at the end of the list or not present.

LinkedList does not support direct access by index, so search always requires sequential traversal of elements.