Complexity for doubly linked lists

Here is the best, worst, and average-case complexity for doubly linked list operations. It is similar to that of singly linked list operations:

Operation

Time Complexity: Worst Case

Time Complexity: Average Case

Insert at beginning or end

O(1)

O(1)

Delete at beginning or end

O(1)

O(1)

Search

O(n)

O(n)

Access

O(n)

O(n)

 

Get PHP 7 Data Structures and Algorithms now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.