Doubly Linked List Operations

📑 5 slides 👁 16 views 📅 2/14/2026
0.0 (0 ratings)

Introduction to Doubly Linked Lists

A doubly linked list has nodes with data, next, and previous pointers.

Introduction to Doubly Linked Lists
2

Creation of Doubly Linked Lists

  • Initialize head and tail pointers to NULL for an empty list.
  • Each new node is allocated memory and pointers are set accordingly.
  • Time complexity for creation is O(1) per node, O(n) for n nodes.
Creation of Doubly Linked Lists
3

Insertion Operations

  • Can insert at head, tail, or any specific position in the list.
  • Requires updating both next and previous pointers of adjacent nodes.
  • Time complexity: O(1) for head/tail, O(n) for arbitrary position.
Insertion Operations
4

Deletion Operations

  • Similar to insertion but requires proper memory deallocation.
  • Edge cases include empty list, single node, head/tail deletions.
  • Time complexity matches insertion operations at respective positions.
Deletion Operations
5

Traversal and Applications

  • Forward and backward traversal follows next/previous pointers.
  • Used in browsers (back/forward), undo/redo operations, and MRU caches.
  • Overall time complexity for full traversal is O(n) in either direction.
Traversal and Applications
1 / 5