Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • DSA
  • Interview Problems on Linked List
  • Practice Linked List
  • MCQs on Linked List
  • Linked List Tutorial
  • Types of Linked List
  • Singly Linked List
  • Doubly Linked List
  • Circular Linked List
  • Circular Doubly Linked List
  • Linked List vs Array
  • Time & Space Complexity
  • Advantages & Disadvantages
Open In App
Next Article:
Insertion in a Doubly Linked List
Next article icon

Insertion in Doubly Circular Linked List

Last Updated : 16 Sep, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Circular Doubly Linked List has properties of both doubly linked list and circular linked list in which two consecutive elements are linked or connected by the previous and next pointer and the last node points to the first node by the next pointer and also the first node points to the last node by the previous pointer. In this article, we will learn about different ways to insert a node in a doubly circular linked list.

Table of Content

  • Insertion at the Beginning in Doubly Circular Linked List – O(1) Time and O(1) Space
  • Insertion at the End in Doubly Circular Linked List – O(1) Time and O(1) Space
  • Insertion after a given node in Doubly Circular Linked List – O(n) Time and O(1) Space
  • Insertion before a given node in Doubly Circular Linked List – O(n) Time and O(1) Space
  • Insertion at a specific position in Doubly Circular Linked List – O(n) Time and O(1) Space

Insertion at the Beginning in Doubly Circular Linked List – O(1) Time and O(1) Space:

To insert a new node at the front of a doubly circular linked list,

  • Allocate memory for the new node.
  • If the list is empty, set the new node’s next and prev to point to itself, and update the head to this new node.
  • For a non-empty list, insert the new node:
    • Set the new node’s next to the current head.
    • Set the new node’s prev to the last node.
    • Update the current head’s prev to the new node.
    • Update the last node’s next to the new node.
  • Set the new node as the new head of the list.
C++
// C++ code of insert node at begin in  // doubly Circular linked list. #include <iostream> using namespace std;  class Node { public:     int data;     Node* next;     Node* prev;          Node(int x) {     	data = x;       	next = nullptr;       	prev = nullptr;     } };   // Function to insert a node at the  // beginning of the doubly circular linked list Node* insertAtBeginning(Node* head, int newData) {        Node* newNode = new Node(newData);          if (!head) {         newNode->next = newNode->prev = newNode;         head = newNode;     } else {                // List is not empty       	// Last node in the list         Node* last = head->prev;           // Insert new node         newNode->next = head;         newNode->prev = last;         head->prev = newNode;         last->next = newNode;                  // Update head         head = newNode;     }          return head; }  void printList(Node* head) {     if (!head) return;     Node* curr = head;     do {         cout << curr->data << " ";         curr = curr->next;     } while (curr != head);     cout << endl; }  int main() {        // Linked List : 10<->20<->30     Node* head = new Node(10);     head->next = new Node(20);     head->next->prev = head;     head->next->next = new Node(30);     head->next->next->prev = head->next;     head->next->next->next = head;     head->prev = head->next->next;      head = insertAtBeginning(head, 5);     printList(head);      return 0; } 
C
// C code of insert node at begin in  // doubly Circular linked list.  #include <stdio.h> #include <stdlib.h>  struct Node {     int data;     struct Node* next;     struct Node* prev; };   struct Node* createNode(int x);  // Function to insert a node at the  // beginning of the doubly circular linked list struct Node* insertAtBeginning(struct Node* head, int newData) {        struct Node* newNode = createNode(newData);          if (!head) {         newNode->next = newNode->prev = newNode;         head = newNode;     } else {                // List is not empty         struct Node* last = head->prev;           // Insert new node         newNode->next = head;         newNode->prev = last;         head->prev = newNode;         last->next = newNode;                  // Update head         head = newNode;     }          return head; }  void printList(struct Node* head) {     if (!head) return;     struct Node* curr = head;     do {         printf("%d ", curr->data);         curr = curr->next;     } while (curr != head);     printf("\n"); }  struct Node* createNode(int x) {     struct Node* newNode =        (struct Node*)malloc(sizeof(struct Node));     newNode->data = x;     newNode->next = newNode->prev = NULL;     return newNode; }  int main(){        // Linked List : 10<->20<->30     struct Node* head = createNode(10);     head->next = createNode(20);     head->next->prev = head;     head->next->next = createNode(30);     head->next->next->prev = head->next;     head->next->next->next = head;     head->prev = head->next->next;       head = insertAtBeginning(head, 5);     printList(head);      return 0; } 
Java
// Java code of insert node at begin in  // doubly Circular linked list.  class Node {     int data;     Node next;     Node prev;      Node(int x) {         data = x;         next = null;       	prev = null;     } }  class GfG {      // Function to insert a node at the beginning   	// of the doubly circular linked list    	static Node insertAtBeginning(Node head, int newData) {         Node newNode = new Node(newData);                  if (head == null) {                        // List is empty             newNode.next = newNode.prev = newNode;             head = newNode;         } else {                        // List is not empty             Node last = head.prev;              // Insert new node             newNode.next = head;             newNode.prev = last;             head.prev = newNode;             last.next = newNode;                          // Update head             head = newNode;         }                  return head;     }      static void printList(Node head) {         if (head == null) return;         Node curr = head;         do {             System.out.print(curr.data + " ");             curr = curr.next;         } while (curr != head);         System.out.println();     }      public static void main(String[] args) {                // Linked List : 10<->20<->30         Node head = new Node(10);         head.next = new Node(20);         head.next.prev = head;         head.next.next = new Node(30);         head.next.next.prev = head.next;         head.next.next.next = head;         head.prev = head.next.next;          head = insertAtBeginning(head, 5);         printList(head);     } } 
Python
# Python code of insert node at begin in  # doubly Circular linked list.  class Node:     def __init__(self, x):         self.data = x         self.next = None         self.prev = None  def insertAtBeginning(head, newData):     newNode = Node(newData)          if head is None:                # List is empty         newNode.next = newNode.prev = newNode         head = newNode     else:                # List is not empty         last = head.prev           # Insert new node         newNode.next = head         newNode.prev = last         head.prev = newNode         last.next = newNode                  # Update head         head = newNode          return head  def printList(head):     if not head:         return     curr = head     while True:         print(curr.data, end=" ")         curr = curr.next         if curr == head:             break     print()  # Linked List : 10<->20<->30 head = Node(10) head.next = Node(20) head.next.prev = head head.next.next = Node(30) head.next.next.prev = head.next head.next.next.next = head head.prev = head.next.next  head = insertAtBeginning(head, 5) printList(head) 
C#
// C# code of insert node at begin in  // doubly Circular linked list. using System;  class Node {     public int Data;     public Node next;     public Node prev;      public Node(int x) {         Data = x;         next = null;         prev = null;     } }  class GfG {      // Function to insert a node at the      // beginning of the doubly circular linked list     static Node InsertAtBeginning(Node head, int newData) {         Node newNode = new Node(newData);                  if (head == null) {                        // List is empty             newNode.next = newNode.prev = newNode;             head = newNode;         } else {                        // List is not empty             Node last = head.prev;              // Insert new node             newNode.next = head;             newNode.prev = last;             head.prev = newNode;             last.next = newNode;                          // Update head             head = newNode;         }                  return head;     }        static void PrintList(Node head) {         if (head == null) return;         Node curr = head;         do {             Console.Write(curr.Data + " ");             curr = curr.next;         } while (curr != head);         Console.WriteLine();     }      static void Main() {                // Linked List : 10<->20<->30         Node head = new Node(10);         head.next = new Node(20);         head.next.prev = head;         head.next.next = new Node(30);         head.next.next.prev = head.next;         head.next.next.next = head;         head.prev = head.next.next;                head = InsertAtBeginning(head, 5);         PrintList(head);     } } 
JavaScript
// Javascript code of insert node at begin in  // doubly Circular linked list.  class Node {     constructor(x) {         this.data = x;         this.next = null;         this.prev = null;     } }  function insertAtBeginning(head, newData) {     let newNode = new Node(newData);          if (!head) {              // List is empty         newNode.next = newNode.prev = newNode;         head = newNode;     } else {              // List is not empty         let last = head.prev;          // Insert new node         newNode.next = head;         newNode.prev = last;         head.prev = newNode;         last.next = newNode;                  // Update head         head = newNode;     }          return head; }  function printList(head) {     if (!head) return;     let curr = head;     do {         console.log(curr.data + " ");         curr = curr.next;     } while (curr !== head);     console.log(); }  // Linked List : 10<->20<->30 let head = new Node(10); head.next = new Node(20); head.next.prev = head; head.next.next = new Node(30); head.next.next.prev = head.next; head.next.next.next = head; head.prev = head.next.next;  head = insertAtBeginning(head, 5); printList(head); 

Output
5 10 20 30  

Time Complexity: O(1), Since we are not traversing the list.
Auxiliary Space: O(1)

Insertion at the End in Doubly Circular Linked List – O(1) Time and O(1) Space:

To insert a new node at the end of doubly circular linked list,

  • Allocate memory for the new node.
  • If the list is empty, set the new node’s next and prev pointers to point to itself, and update the head to this new node.
  • For a non-empty list, insert the new node:
    • Find the current last node (the node whose next pointer points to the head).
    • Set the new node’s next pointer to point to the head.
    • Set the new node’s prev pointer to point to the current last node.
    • Update the current last node’s next pointer to point to the new node.
    • Update the head’s prev pointer to point to the new node.
C++
// C++ code of insert node at End in  // doubly Circular linked list.  #include <iostream> using namespace std;  class Node { public:     int data;     Node* next;     Node* prev;          Node(int x) {         data = x;         next = nullptr;       	prev = nullptr;     } };  // Function to insert a node at the end of  // the doubly circular linked list Node* insertAtEnd(Node* head, int newData) {     Node* newNode = new Node(newData);          if (!head) {                // List is empty         newNode->next = newNode->prev = newNode;         head = newNode;     } else {                // List is not empty         Node* last = head->prev;                   // Insert new node at the end         newNode->next = head;         newNode->prev = last;         last->next = newNode;         head->prev = newNode;     }          return head; }  void printList(Node* head) {     if (!head) return;     Node* curr = head;     do {         cout << curr->data << " ";         curr = curr->next;     } while (curr != head);     cout << endl; }  int main() {        // Linked List : 10<->20<->30     Node* head = new Node(10);     head->next = new Node(20);     head->next->prev = head;     head->next->next = new Node(30);     head->next->next->prev = head->next;     head->next->next->next = head;     head->prev = head->next->next;      head = insertAtEnd(head, 5);     printList(head);      return 0; } 
C
// C code of insert node at End in  // doubly Circular linked list.  #include <stdio.h> #include <stdlib.h>  struct Node {     int data;     struct Node* next;     struct Node* prev; };  struct Node* createNode(int x) {     struct Node* newNode =        (struct Node*)malloc(sizeof(struct Node));     newNode->data = x;     newNode->next = newNode->prev = NULL;     return newNode; }  // Function to insert a node at the end  // of the doubly circular linked list struct Node* insertAtEnd(struct Node* head, int newData) {     struct Node* newNode = createNode(newData);          if (!head) {                // List is empty         newNode->next = newNode->prev = newNode;         head = newNode;     } else {                // List is not empty         struct Node* last = head->prev;                   // Insert new node at the end         newNode->next = head;         newNode->prev = last;         last->next = newNode;         head->prev = newNode;     }          return head; }  void printList(struct Node* head) {     if (!head) return;     struct Node* curr = head;     do {         printf("%d ", curr->data);         curr = curr->next;     } while (curr != head);     printf("\n"); }  int main() {        // Linked List : 10<->20<->30     struct Node* head = createNode(10);     head->next = createNode(20);     head->next->prev = head;     head->next->next = createNode(30);     head->next->next->prev = head->next;     head->next->next->next = head;     head->prev = head->next->next;      head = insertAtEnd(head, 5);     printList(head);      return 0; } 
Java
// Java code of insert node at End in  // doubly Circular linked list.  class Node {     int data;     Node next;     Node prev;      Node(int x) {         data = x;         next = null;       	prev = null;     } }  class GfG {        // Function to insert a node at the end      // of the doubly circular linked list     static Node insertAtEnd(Node head, int newData) {         Node newNode = new Node(newData);          if (head == null) {                        // List is empty             newNode.next = newNode.prev = newNode;             head = newNode;         } else {                        // List is not empty             Node last = head.prev;               // Insert new node at the end             newNode.next = head;             newNode.prev = last;             last.next = newNode;             head.prev = newNode;         }          return head;     }      static void printList(Node head) {         if (head == null) return;         Node curr = head;         do {             System.out.print(curr.data + " ");             curr = curr.next;         } while (curr != head);         System.out.println();     }      public static void main(String[] args) {                // Linked List : 10<->20<->30         Node head = new Node(10);         head.next = new Node(20);         head.next.prev = head;         head.next.next = new Node(30);         head.next.next.prev = head.next;         head.next.next.next = head;         head.prev = head.next.next;          head = insertAtEnd(head, 5);         printList(head);     } } 
Python
# Python code of insert node at End in  # doubly Circular linked list.  class Node:     def __init__(self, x):         self.data = x         self.next = self.prev = None  def insert_at_end(head, new_data):     new_node = Node(new_data)          if head is None:                # List is empty         new_node.next = new_node.prev = new_node         head = new_node     else:                # List is not empty         last = head.prev                   # Insert new node at the end         new_node.next = head         new_node.prev = last         last.next = new_node         head.prev = new_node          return head  def print_list(head):     if head is None:         return     curr = head     while True:         print(curr.data, end=" ")         curr = curr.next         if curr == head:             break     print()  if __name__ == "__main__":        # Linked List : 10<->20<->30     head = Node(10)     head.next = Node(20)     head.next.prev = head     head.next.next = Node(30)     head.next.next.prev = head.next     head.next.next.next = head     head.prev = head.next.next      head = insert_at_end(head, 5)     print_list(head) 
C#
// Python code of insert node at End in  // doubly Circular linked list. using System;  class Node {     public int Data;     public Node next;     public Node prev;      public Node(int x) {         Data = x;         next = null;       	prev = null;     } }  class GfG {        // Function to insert a node at the end of      // the doubly circular linked list     static Node InsertAtEnd(Node head, int newData) {         Node newNode = new Node(newData);          if (head == null) {                        // List is empty             newNode.next = newNode.prev = newNode;             head = newNode;         } else {                        // List is not empty             Node last = head.prev;               // Insert new node at the end             newNode.next = head;             newNode.prev = last;             last.next = newNode;             head.prev = newNode;         }          return head;     }      static void PrintList(Node head) {         if (head == null) return;         Node curr = head;         do {             Console.Write(curr.Data + " ");             curr = curr.next;         } while (curr != head);         Console.WriteLine();     }      static void Main() {                // Linked List : 10<->20<->30         Node head = new Node(10);         head.next = new Node(20);         head.next.prev = head;         head.next.next = new Node(30);         head.next.next.prev = head.next;         head.next.next.next = head;         head.prev = head.next.next;                head = InsertAtEnd(head, 5);         PrintList(head);     } } 
JavaScript
// Javascript code of insert node at End in  // doubly Circular linked list. class Node {     constructor(x) {         this.data = x;         this.next = this.prev = null;     } }  // Function to insert a node at the  // end of the doubly circular linked list function insertAtEnd(head, newData) {     const newNode = new Node(newData);          if (head === null) {              // List is empty         newNode.next = newNode.prev = newNode;         head = newNode;     } else {              // List is not empty         const last = head.prev;                  // Insert new node at the end         newNode.next = head;         newNode.prev = last;         last.next = newNode;         head.prev = newNode;     }          return head; }  function printList(head) {     if (head === null) return;     let curr = head;     do {         console.log(curr.data + " ");         curr = curr.next;     } while (curr !== head);     console.log(); }  // Linked List : 10<->20<->30 let head = new Node(10); head.next = new Node(20); head.next.prev = head; head.next.next = new Node(30); head.next.next.prev = head.next; head.next.next.next = head; head.prev = head.next.next;  head = insertAtEnd(head, 5); printList(head); 

Output
10 20 30 5  

Time Complexity: O(1). Since we are not travesing the list.
Auxiliary Space: O(1)

Insertion after a given node in Doubly Circular Linked List – O(n) Time and O(1) Space:

To insert a new node after a given node in doubly circular linked list,

  • Allocate memory for the new node.
  • Traverse the list to locate given node.
  • Insert the newNode:
    • Set newNode->next to given node’next.
    • Set newNode->prev to givenNode.
    • Update givenNode->next->prev to newNode.
    • Update givenNode->next to newNode.
    • If givenNode is the last node (i.e., points to head), update head->prev to newNode.
C++
// C++ code of insert after given node in  // doubly Circular linked list.  #include <iostream> using namespace std;  class Node { public:     int data;     Node* next;     Node* prev;          Node(int x) {         data = x;         next = nullptr;       	prev = nullptr;     } };  // Function to insert a node after a given node in  // the doubly circular linked list Node* insertAfterNode(Node* head, int newData, int givenData) {     Node* newNode = new Node(newData); 	   	// If the list is empty, return nullptr     if (!head) return nullptr;       // Find the node with the given data     Node* curr = head;     do {         if (curr->data == givenData) {                        // Insert the new node after the given node             newNode->next = curr->next;             newNode->prev = curr;              curr->next->prev = newNode;             curr->next = newNode;              // If the given node was the last node,            	// update head's prev             if (curr == head->prev) {                 head->prev = newNode;             }            			// Return the updated head             return head;          }         curr = curr->next;     } while (curr != head);      return head;  }  void printList(Node* head) {     if (!head) return;     Node* curr = head;     do {         cout << curr->data << " ";         curr = curr->next;     } while (curr != head);     cout << endl; }  int main() {        // Linked List : 10<->20<->30     Node* head = new Node(10);     head->next = new Node(20);     head->next->prev = head;     head->next->next = new Node(30);     head->next->next->prev = head->next;     head->next->next->next = head;     head->prev = head->next->next;      head = insertAfterNode(head, 5, 10);     printList(head);      return 0; } 
C
// C code to insert a node after a given node in  // a doubly circular linked list  #include <stdio.h> #include <stdlib.h>  struct Node {     int data;     struct Node* next;     struct Node* prev; };   struct Node* createNode(int x);  // Function to insert a node after a given node in  // the doubly circular linked list struct Node* insertAfterNode(struct Node* head, int newData, int givenData) {     struct Node* newNode = createNode(newData);          // If the list is empty, return nullptr     if (!head) return NULL;      // Find the node with the given data     struct Node* curr = head;     do {         if (curr->data == givenData) {                        // Insert the new node after the given node             newNode->next = curr->next;             newNode->prev = curr;              curr->next->prev = newNode;             curr->next = newNode;              // If the given node was the last node,            	// update head's prev             if (curr == head->prev) {                 head->prev = newNode;             }                        // Return the updated head             return head;          }         curr = curr->next;     } while (curr != head);      return head;  }   void printList(struct Node* head) {     if (!head) return;     struct Node* curr = head;     do {         printf("%d ", curr->data);         curr = curr->next;     } while (curr != head);     printf("\n"); }  struct Node* createNode(int x) {     struct Node* newNode =        (struct Node*)malloc(sizeof(struct Node));     newNode->data = x;     newNode->next = newNode->prev = NULL;     return newNode; }  int main() {        // Linked List : 10<->20<->30     struct Node* head = createNode(10);     head->next = createNode(20);     head->next->prev = head;     head->next->next = createNode(30);     head->next->next->prev = head->next;     head->next->next->next = head;     head->prev = head->next->next;        head = insertAfterNode(head, 5, 10);     printList(head);      return 0; } 
Java
// Java code to insert after a given node in  // a doubly circular linked list.  class Node {     int data;     Node next;     Node prev;      Node(int data) {         this.data = data;         next = null;       	prev = null;     } }   class GfG {        // Function to insert a node after a given node in      // the doubly circular linked list     static Node insertAfterNode(Node head, int newData, int givenData) {         Node newNode = new Node(newData);                  // If the list is empty, return null         if (head == null) return null;          // Find the node with the given data         Node curr = head;         do {             if (curr.data == givenData) {                                  // Insert the new node after the given node                 newNode.next = curr.next;                 newNode.prev = curr;                  curr.next.prev = newNode;                 curr.next = newNode;                  // If the given node was the last node,                	// update head's prev                 if (curr == head.prev) {                     head.prev = newNode;                 }                                  // Return the updated head                 return head;             }             curr = curr.next;         } while (curr != head);          return head;     }        static void printList(Node head) {         if (head == null) return;         Node curr = head;         do {             System.out.print(curr.data + " ");             curr = curr.next;         } while (curr != head);         System.out.println();     }      public static void main(String[] args) {                //Linked List : 10<->20<->30         Node head = new Node(10);         head.next = new Node(20);         head.next.prev = head;         head.next.next = new Node(30);         head.next.next.prev = head.next;         head.next.next.next = head;         head.prev = head.next.next;          head = insertAfterNode(head, 5, 10);         printList(head);     } } 
Python
# Python code to insert a node after a given node  # in a doubly circular linked list  class Node:     def __init__(self, data):         self.data = data         self.next = None         self.prev = None  # Function to insert a node after a given node in  # the doubly circular linked list def insertAfterNode(head, newData, givenData):     newNode = Node(newData)          # If the list is empty, return None     if not head:         return None          # Find the node with the given data     curr = head     while True:         if curr.data == givenData:                          # Insert the new node after the given node             newNode.next = curr.next             newNode.prev = curr              curr.next.prev = newNode             curr.next = newNode              # If the given node was the last node,             # update head's prev             if curr == head.prev:                 head.prev = newNode                          # Return the updated head             return head          curr = curr.next         if curr == head:             break      return head  def printList(head):     if not head:         return     curr = head     while True:         print(curr.data, end=" ")         curr = curr.next         if curr == head:             break     print()  if __name__ == "__main__":        # Linked List : 10<->20<->30     head = Node(10)     head.next = Node(20)     head.next.prev = head     head.next.next = Node(30)     head.next.next.prev = head.next     head.next.next.next = head     head.prev = head.next.next      head = insertAfterNode(head, 5, 10)     printList(head) 
C#
// C# code to insert after a given node in a  // doubly circular linked list.  using System;  class Node {     public int data;     public Node next;     public Node prev;        public Node(int data) {         this.data = data;         next = prev = null;     } }  class GfG {        // Function to insert a node after a given node in      // the doubly circular linked list     static Node InsertAfterNode(Node head, int newData, int givenData) {         Node newNode = new Node(newData);                  // If the list is empty, return null         if (head == null) return null;          // Find the node with the given data         Node curr = head;         do {             if (curr.data == givenData) {                                  // Insert the new node after the given node                 newNode.next = curr.next;                 newNode.prev = curr;                  curr.next.prev = newNode;                 curr.next = newNode;                  // If the given node was the last node,               	// update head's prev                 if (curr == head.prev) {                     head.prev = newNode;                 }                                  // Return the updated head                 return head;             }             curr = curr.next;         } while (curr != head);          return head;     }     	static void PrintList(Node head) {         if (head == null) return;         Node curr = head;         do {             Console.Write(curr.data + " ");             curr = curr.next;         } while (curr != head);         Console.WriteLine();     }      static void Main(string[] args) {               //Linked List : 10<->20<->30         Node head = new Node(10);         head.next = new Node(20);         head.next.prev = head;         head.next.next = new Node(30);         head.next.next.prev = head.next;         head.next.next.next = head;         head.prev = head.next.next;                head = InsertAfterNode(head, 5, 10);         PrintList(head);     } } 
JavaScript
// JavaScript code to insert after a given node  // in a doubly circular linked list.  class Node {     constructor(data) {         this.data = data;         this.next = null;         this.prev = null;     } }  // Function to insert a node after a given node in  // the doubly circular linked list function insertAfterNode(head, newData, givenData) {     let newNode = new Node(newData);      // If the list is empty, return null     if (!head) return null;      // Find the node with the given data     let curr = head;     do {         if (curr.data === givenData) {                          // Insert the new node after the given node             newNode.next = curr.next;             newNode.prev = curr;              curr.next.prev = newNode;             curr.next = newNode;              // If the given node was the last node,             // update head's prev             if (curr === head.prev) {                 head.prev = newNode;             }                          // Return the updated head             return head;         }         curr = curr.next;     } while (curr !== head);      return head; }  function printList(head) {     if (!head) return;     let curr = head;     do {         console.log(curr.data + " ");         curr = curr.next;     } while (curr !== head);     console.log(); }  // Linked List : 10<->20<->30 let head = new Node(10); head.next = new Node(20); head.next.prev = head; head.next.next = new Node(30); head.next.next.prev = head.next; head.next.next.next = head; head.prev = head.next.next;  head = insertAfterNode(head, 5, 10); printList(head); 

Output
10 5 20 30  

Time Complexity: O(n), Traversing over the linked list of size n. 
Auxiliary Space: O(1)

Insertion before a given node in Doubly Circular Linked List – O(n) Time and O(1) Space:

To insert a new node before a specific node in doubly circular linked list,

  • Allocate memory for the new node.
  • Traverse the list to locate the givenNode.
  • Insert the New Node:
    • Set newNode->next to givenNode.
    • Set newNode->prev to givenNode->prev.
    • Update givenNode->prev->next to newNode.
    • Update givenNode->prev to newNode.
  • Update Head (if givenNode is the head node), set head to newNode.
C++
// C++ code to insert before a given node in  // a doubly circular linked list.  #include <iostream> using namespace std;  class Node { public:     int data;     Node* next;     Node* prev;          Node(int x) {         data = x;         next = nullptr;       	prev = nullptr;     } };  // Function to insert a node before a given node in  // the doubly circular linked list Node* insertBeforeNode(Node* head, int newData, int givenData) {     Node* newNode = new Node(newData);      // If the list is empty, return nullptr     if (!head) return nullptr;      // Find the node with the given data     Node* curr = head;     do {         if (curr->data == givenData) {                        // Insert the new node before the given node             newNode->next = curr;             newNode->prev = curr->prev;              curr->prev->next = newNode;             curr->prev = newNode;              // If the given node was the head,            	// update the head             if (curr == head) {                 head = newNode;             }              // Return the updated head             return head;         }         curr = curr->next;     } while (curr != head);      return head; }  void printList(Node* head) {     if (!head) return;     Node* curr = head;     do {         cout << curr->data << " ";         curr = curr->next;     } while (curr != head);     cout << endl; }  int main() {        // Linked List : 10<->20<->30     Node* head = new Node(10);     head->next = new Node(20);     head->next->prev = head;     head->next->next = new Node(30);     head->next->next->prev = head->next;     head->next->next->next = head;     head->prev = head->next->next;      head = insertBeforeNode(head, 5, 30);     printList(head);      return 0; } 
C
// C code to insert a node befor a given node in  // a doubly circular linked list  #include <stdio.h> #include <stdlib.h>  struct Node {     int data;     struct Node* next;     struct Node* prev; };  struct Node* createNode(int x);  // Function to insert a node before a given node in  // the doubly circular linked list struct Node* insertBeforeNode(struct Node* head, int newData, int givenData) {     struct Node* newNode = createNode(newData);      // If the list is empty, return nullptr     if (!head) return NULL;      // Find the node with the given data     struct Node* curr = head;     do {         if (curr->data == givenData) {                        // Insert the new node before the given node             newNode->next = curr;             newNode->prev = curr->prev;              curr->prev->next = newNode;             curr->prev = newNode;              // If the given node was the head, update the head             if (curr == head) {                 head = newNode;             }              // Return the updated head             return head;         }         curr = curr->next;     } while (curr != head);      return head; }  void printList(struct Node* head) {     if (!head) return;     struct Node* curr = head;     do {         printf("%d ", curr->data);         curr = curr->next;     } while (curr != head);     printf("\n"); }  struct Node* createNode(int x) {     struct Node* newNode =        (struct Node*)malloc(sizeof(struct Node));     newNode->data = x;     newNode->next = newNode->prev = NULL;     return newNode; }  int main() {         //Linked List : 10<->20<->30     struct Node* head = createNode(10);     head->next = createNode(20);     head->next->prev = head;     head->next->next = createNode(30);     head->next->next->prev = head->next;     head->next->next->next = head;     head->prev = head->next->next;      head = insertBeforeNode(head, 5, 30);     printList(head);      return 0; } 
Java
// Java code to insert before a given node in  // a doubly circular linked list.  class Node {     int data;     Node next;     Node prev;      Node(int x) {         data = x;         next = null;       	prev = null;     } }  // Function to insert a node before a given node in  // the doubly circular linked list class GfG {     static Node insertBeforeNode(Node head, int newData, int givenData) {         Node newNode = new Node(newData);          // If the list is empty, return null         if (head == null) return null;          // Find the node with the given data         Node curr = head;         do {             if (curr.data == givenData) {                                // Insert the new node before the given node                 newNode.next = curr;                 newNode.prev = curr.prev;                  curr.prev.next = newNode;                 curr.prev = newNode;                  // If the given node was the head,                	// update the head                 if (curr == head) {                     head = newNode;                 }                  // Return the updated head                 return head;             }             curr = curr.next;         } while (curr != head);          return head;     }      static void printList(Node head) {         if (head == null) return;         Node curr = head;         do {             System.out.print(curr.data + " ");             curr = curr.next;         } while (curr != head);         System.out.println();     }      public static void main(String[] args) {                // Linked List : 10<->20<->30         Node head = new Node(10);         head.next = new Node(20);         head.next.prev = head;         head.next.next = new Node(30);         head.next.next.prev = head.next;         head.next.next.next = head;         head.prev = head.next.next;                head = insertBeforeNode(head, 5, 30);         printList(head);     } } 
Python
# Python code to insert before a given node in  # a doubly circular linked list.  class Node:     def __init__(self, data):         self.data = data         self.next = None         self.prev = None  # Function to insert a node before a given node in  # the doubly circular linked list def insertBeforeNode(head, newData, givenData):     newNode = Node(newData)      # If the list is empty, return None     if not head:         return None      # Find the node with the given data     curr = head     while True:         if curr.data == givenData:                        # Insert the new node before the given node             newNode.next = curr             newNode.prev = curr.prev              curr.prev.next = newNode             curr.prev = newNode              # If the given node was the head,              # update the head             if curr == head:                 head = newNode              # Return the updated head             return head         curr = curr.next         if curr == head:             break      return head  def printList(head):     if not head:         return     curr = head     while True:         print(curr.data, end=" ")         curr = curr.next         if curr == head:             break     print()  if __name__ == "__main__":        # Linked List : 10<->20<->30     head = Node(10)     head.next = Node(20)     head.next.prev = head     head.next.next = Node(30)     head.next.next.prev = head.next     head.next.next.next = head     head.prev = head.next.next           head = insertBeforeNode(head, 5, 30)     printList(head) 
C#
// C# code to insert before a given node in  // a doubly circular linked list.  using System;  class Node {     public int data;     public Node next;     public Node prev;      public Node(int x) {         data = x;         next = null;       	prev = null;     } }  // Function to insert a node before a given node in  // the doubly circular linked list class GfG {     static Node InsertBeforeNode(Node head, int newData, int givenData) {         Node newNode = new Node(newData);          // If the list is empty, return null         if (head == null) return null;          // Find the node with the given data         Node curr = head;         do {             if (curr.data == givenData) {                                // Insert the new node before the given node                 newNode.next = curr;                 newNode.prev = curr.prev;                  curr.prev.next = newNode;                 curr.prev = newNode;                  // If the given node was the head,                	//update the head                 if (curr == head) {                     head = newNode;                 }                  // Return the updated head                 return head;             }             curr = curr.next;         } while (curr != head);          return head;     }      static void PrintList(Node head) {         if (head == null) return;         Node curr = head;         do {             Console.Write(curr.data + " ");             curr = curr.next;         } while (curr != head);         Console.WriteLine();     }      static void Main(string[] args) {                // Linked List : 10<->20<->30         Node head = new Node(10);         head.next = new Node(20);         head.next.prev = head;         head.next.next = new Node(30);         head.next.next.prev = head.next;         head.next.next.next = head;         head.prev = head.next.next;          head = InsertBeforeNode(head, 5, 30);         PrintList(head);     } } 
JavaScript
// JavaScript code to insert before a given node in  // a doubly circular linked list.  class Node {     constructor(data) {         this.data = data;         this.next = null;         this.prev = null;     } }  // Function to insert a node before a given node in  // the doubly circular linked list function insertBeforeNode(head, newData, givenData) {     let newNode = new Node(newData);      // If the list is empty, return null     if (!head) return null;      // Find the node with the given data     let curr = head;     do {         if (curr.data === givenData) {                      // Insert the new node before the given node             newNode.next = curr;             newNode.prev = curr.prev;              curr.prev.next = newNode;             curr.prev = newNode;              // If the given node was the head,              // update the head             if (curr === head) {                 head = newNode;             }              // Return the updated head             return head;         }         curr = curr.next;     } while (curr !== head);      return head; }  function printList(head) {     if (!head) return;     let curr = head;     do {         console.log(curr.data + " ");         curr = curr.next;     } while (curr !== head);     console.log(); }  // Linked List : 10<->20<->30 let head = new Node(10); head.next = new Node(20); head.next.prev = head; head.next.next = new Node(30); head.next.next.prev = head.next; head.next.next.next = head; head.prev = head.next.next;  head = insertBeforeNode(head, 5, 30); printList(head); 

Output
10 20 5 30  

Time Complexity: O(n), Traversing over the linked list of size n. 
Auxiliary Space: O(1)

Insertion at a specific position in Doubly Circular Linked List – O(n) Time and O(1) Space:

To insert a new node at a specific position in doubly circular linked list,

  • Allocate memory for the new node.
  • Initialize a pointer curr pointer to the head node and start traversing the list we reach the node just before the desired position. Use a counter to keep track of the curr position.
  • Insert the New Node:
    • Set newNode->next to curr->next.
    • Set newNode->prev to curr.
    • Update curr->next->prev to newNode.
    • Update current->next to newNode.
  • Update Head (if the insertion is at position 0 and the list is empty), set head to newNode.
C++
// C++ code to insert a new node at a specific position in  // a doubly circular linked list.  #include <iostream> using namespace std;  class Node { public:     int data;     Node* next;     Node* prev;          Node(int x) {         data = x;         next = nullptr;       	prev = nullptr;     } };  // Function to add a node after a given position in  // the doubly circular linked list Node* addNode(Node* head, int pos, int newData) {     Node* newNode = new Node(newData); 	     // If the list is empty, return nullptr     if (!head) {       	if (pos > 1) {          	return nullptr;          }       	// New node becomes the only node in the circular list      	newNode->prev = newNode;       	newNode->next = newNode;       	return newNode;      }        if (pos == 1) {      	// Insert at the beginning of the list         newNode->next = head;         newNode->prev = head->prev;         head->prev->next = newNode;         head->prev = newNode;         return newNode;     }      // Traverse to the p-th position     Node* curr = head;     for (int i = 1; i < pos - 1; i++) {         curr = curr->next;         if (curr == head) {             cout << "Position out of range!" << endl;             return head;         }     }      // Insert the new node after the    	// current node (at the given position)     newNode->next = curr->next;     newNode->prev = curr;      if (curr->next != nullptr) {         curr->next->prev = newNode;     }     curr->next = newNode;      // Return the updated head     return head; }  void printList(Node* head) {     if (!head) return;     Node* curr = head;     do {         cout << curr->data << " ";         curr = curr->next;     } while (curr != head);     cout << endl; }  int main() {        // Linked List : 10<->20<->30     Node* head = new Node(10);     head->next = new Node(20);     head->next->prev = head;     head->next->next = new Node(30);     head->next->next->prev = head->next;     head->next->next->next = head;     head->prev = head->next->next;        head = addNode(head, 2, 5);     printList(head);      return 0; } 
C
// C code to insert a new node at a specific position in  // a doubly circular linked list.  #include <stdio.h> #include <stdlib.h>  struct Node {     int data;     struct Node* next;     struct Node* prev; };  struct Node* createNode(int x);  // Function to add a node after a given position in  // the doubly circular linked list struct Node* addNode(struct Node* head, int pos, int newData) {     struct Node* newNode = createNode(newData); 	     // If the list is empty, return nullptr     if (!head) {       	if (pos > 1) {          	return NULL;          }       	// New node becomes the only node in the circular list      	newNode->prev = newNode;       	newNode->next = newNode;       	       	// New node becomes the head       	return newNode;       }        if (pos == 1) {      	// Insert at the beginning of the list         newNode->next = head;         newNode->prev = head->prev;         head->prev->next = newNode;         head->prev = newNode;              	// New node becomes the head         return newNode;      }      // Traverse to the p-th position     struct Node* curr = head;     for (int i = 1; i < pos - 1; i++) {         curr = curr->next;         if (curr == head) {             printf("Position out of range!\n");             return head;         }     }      // Insert the new node after the    	// current node (at the given position)     newNode->next = curr->next;     newNode->prev = curr;      if (curr->next != NULL) {         curr->next->prev = newNode;     }     curr->next = newNode;      // Return the updated head     return head; }  void printList(struct Node* head) {     if (!head) return;     struct Node* curr = head;     do {         printf("%d ", curr->data);         curr = curr->next;     } while (curr != head);     printf("\n"); }  struct Node* createNode(int x) {     struct Node* newNode =        (struct Node*)malloc(sizeof(struct Node));     newNode->data = x;     newNode->next = NULL;     newNode->prev = NULL;     return newNode; }  int main() {        // Linked List : 10<->20<->30     struct Node* head = createNode(10);     head->next = createNode(20);     head->next->prev = head;     head->next->next = createNode(30);     head->next->next->prev = head->next;     head->next->next->next = head;     head->prev = head->next->next;        head = addNode(head, 2, 5);     printList(head);      return 0; } 
Java
// Java code to insert a new node at a specific position in  // a doubly circular linked list.  class Node {     int data;     Node next;     Node prev;      Node(int x) {         data = x;         next = null;         prev = null;     } }  class GfG {      // Function to add a node after a given position in     // the doubly circular linked list     public static Node addNode(Node head, int pos, int newData) {         Node newNode = new Node(newData);          // If the list is empty, return null         if (head == null) {             if (pos > 1) {                 return null;             }             // New node becomes the only node             // in the circular list             newNode.prev = newNode;             newNode.next = newNode;                      	// Return new node as head             return newNode;           }          if (pos == 1) {                        // Insert at the beginning of the list             newNode.next = head;             newNode.prev = head.prev;             head.prev.next = newNode;             head.prev = newNode;                      	// New node becomes the head             return newNode;          }          // Traverse to the p-th position         Node curr = head;         for (int i = 1; i < pos - 1; i++) {             curr = curr.next;             if (curr == head) {                 System.out.println("Position out of range!");                 return head;             }         }          // Insert the new node after the current        	// node (at the given position)         newNode.next = curr.next;         newNode.prev = curr;          if (curr.next != null) {             curr.next.prev = newNode;         }         curr.next = newNode;          // Return the updated head         return head;     }      static void printList(Node head) {         if (head == null) return;         Node curr = head;         do {             System.out.print(curr.data + " ");             curr = curr.next;         } while (curr != head);         System.out.println();     }      public static void main(String[] args) {                // Linked List: 10<->20<->30         Node head = new Node(10);         head.next = new Node(20);         head.next.prev = head;         head.next.next = new Node(30);         head.next.next.prev = head.next;         head.next.next.next = head;         head.prev = head.next.next;          head = addNode(head, 2, 5);         printList(head);     } } 
Python
# Python code to insert a new node at a specific position in  # a doubly circular linked list.  class Node:     def __init__(self, x):         self.data = x         self.next = None         self.prev = None  # Function to add a node after a given position in  # the doubly circular linked list def addNode(head, pos, newData):     newNode = Node(newData)          # If the list is empty, return None     if not head:         if pos > 1:             return None                    # New node becomes the only node in          # the circular list         newNode.prev = newNode         newNode.next = newNode                  # Return new node as head         return newNode            if pos == 1:                # Insert at the beginning of the list         newNode.next = head         newNode.prev = head.prev         head.prev.next = newNode         head.prev = newNode                  # New node becomes the head         return newNode        # Traverse to the p-th position     curr = head     for i in range(1, pos - 1):         curr = curr.next         if curr == head:             print("Position out of range!")             return head      # Insert the new node after the      # current node (at the given position)     newNode.next = curr.next     newNode.prev = curr      if curr.next:         curr.next.prev = newNode     curr.next = newNode      # Return the updated head     return head  def printList(head):     if not head:         return     curr = head     while True:         print(curr.data, end=" ")         curr = curr.next         if curr == head:             break     print()  if __name__ == "__main__":          # Linked List : 10<->20<->30     head = Node(10)     head.next = Node(20)     head.next.prev = head     head.next.next = Node(30)     head.next.next.prev = head.next     head.next.next.next = head     head.prev = head.next.next          head = addNode(head, 2, 5)     printList(head) 
C#
// C# code to insert a new node at a specific position in  // a doubly circular linked list.  using System;  class Node {     public int data;     public Node next;     public Node prev;      public Node(int x) {         data = x;         next = null;         prev = null;     } }  class GfG {      // Function to add a node after a given position in     // the doubly circular linked list     public static Node addNode(Node head, int pos, int newData) {         Node newNode = new Node(newData);          // If the list is empty, return null         if (head == null) {             if (pos > 1) {                 return null;             }             // New node becomes the only node in            	// the circular list             newNode.prev = newNode;             newNode.next = newNode;                      	// Return new node as head             return newNode;           }          if (pos == 1) {                        // Insert at the beginning of the list             newNode.next = head;             newNode.prev = head.prev;             head.prev.next = newNode;             head.prev = newNode;           	           	// New node becomes the head             return newNode;          }          // Traverse to the p-th position         Node curr = head;         for (int i = 1; i < pos - 1; i++) {             curr = curr.next;             if (curr == head) {                 Console.WriteLine("Position out of range!");                 return head;             }         }          // Insert the new node after the        	// current node (at the given position)         newNode.next = curr.next;         newNode.prev = curr;          if (curr.next != null) {             curr.next.prev = newNode;         }         curr.next = newNode;          // Return the updated head         return head;     }      static void printList(Node head) {         if (head == null) return;         Node curr = head;         do {             Console.Write(curr.data + " ");             curr = curr.next;         } while (curr != head);         Console.WriteLine();     }  	static void Main(string[] args) {                // Linked List: 10<->20<->30         Node head = new Node(10);         head.next = new Node(20);         head.next.prev = head;         head.next.next = new Node(30);         head.next.next.prev = head.next;         head.next.next.next = head;         head.prev = head.next.next;          head = addNode(head, 2, 5);         printList(head);     } } 
JavaScript
// Javascript code to insert a new node at a specific position in  // a doubly circular linked list.  class Node {     constructor(x) {         this.data = x;         this.next = null;         this.prev = null;     } }  // Function to add a node after a given position in  // the doubly circular linked list function addNode(head, pos, newData) {     let newNode = new Node(newData); 	     // If the list is empty, return null     if (!head) {         if (pos > 1) {             return null;          }                	// New node becomes the only node in         // the circular list         newNode.prev = newNode;         newNode.next = newNode;                  // Return new node as head         return newNode;       }        if (pos === 1) {           	// Insert at the beginning of the list         newNode.next = head;         newNode.prev = head.prev;         head.prev.next = newNode;         head.prev = newNode;                  // New node becomes the head         return newNode;     }      // Traverse to the p-th position     let curr = head;     for (let i = 1; i < pos - 1; i++) {         curr = curr.next;         if (curr === head) {             console.log("Position out of range!");             return head;         }     }      // Insert the new node after the      // current node (at the given position)     newNode.next = curr.next;     newNode.prev = curr;      if (curr.next !== null) {         curr.next.prev = newNode;     }     curr.next = newNode;      // Return the updated head     return head; }  function printList(head) {     if (!head) return;     let curr = head;     do {         console.log(curr.data + " ");         curr = curr.next;     } while (curr !== head); }  // Linked List : 10<->20<->30 let head = new Node(10); head.next = new Node(20); head.next.prev = head; head.next.next = new Node(30); head.next.next.prev = head.next; head.next.next.next = head; head.prev = head.next.next;  head = addNode(head, 2, 5); printList(head); 

Output
10 5 20 30  

Time Complexity: O(n), Traversing over the linked list of size n. 
Auxiliary Space: O(1)



Next Article
Insertion in a Doubly Linked List

A

Akash Gupta
Improve
Article Tags :
  • DSA
  • Linked List
  • doubly linked list
Practice Tags :
  • Linked List

Similar Reads

  • Insertion in a Doubly Linked List
    Inserting a new node in a doubly linked list is very similar to inserting new node in linked list. There is a little extra work required to maintain the link of the previous node. In this article, we will learn about different ways to insert a node in a doubly linked list. Table of Content Insertion
    6 min read
  • Introduction to Circular Doubly Linked List
    A circular doubly linked list is defined as a circular linked list in which each node has two links connecting it to the previous node and the next node. Characteristics of Circular Doubly Linked List :A circular doubly linked list has the following properties: Circular: A circular doubly linked lis
    4 min read
  • Insertion at the end in circular linked list
    A circular linked list is a data structure where each node points to the next, and the last node connects back to the first, creating a loop. Insertion at the end in circular linked list is an important operation. Understanding how to perform this insertion is essential for effectively manage and us
    7 min read
  • Insertion in Circular Singly Linked List
    In this article, we will learn how to insert a node into a circular linked list. Insertion is a fundamental operation in linked lists that involves adding a new node to the list. In a circular linked list, the last node connects back to the first node, creating a loop. There are four main ways to ad
    12 min read
  • Insertion at Specific Position in a Circular Doubly Linked List
    Prerequisite: Insert Element Circular Doubly Linked List.Convert an Array to a Circular Doubly Linked List.Given the start pointer pointing to the start of a Circular Doubly Linked List, an element and a position. The task is to insert the element at the specified position in the given Circular Doub
    15+ min read
  • Deletion in Doubly Circular Linked List
    We have discussed the doubly circular linked list introduction and its insertion.Let us formulate the problem statement to understand the deletion process. Given a ‘key’, delete the first occurrence of this key in the circular doubly linked list. Algorithm: Case 1: Empty List(start = NULL) If the li
    15+ min read
  • Insertion in Linked List
    Insertion in a linked list involves adding a new node at a specified position in the list. There are several types of insertion based on the position where the new node is to be added: At the front of the linked list Before a given node.After a given node.At a specific position.At the end of the lin
    4 min read
  • Insertion Sort for Doubly Linked List
    Given a doubly linked list, the task is to sort the doubly linked list in non-decreasing order using the insertion sort. Examples: Input: head: 5<->3<->4<->1<->2Output: 1<->2<->3<->4<->5Explanation: Doubly Linked List after sorting using insertion sort
    10 min read
  • Insertion in an empty List in the circular linked list
    A circular linked list is a type of data structure where each node points to the next one, and the last node connects back to the first, forming a circle. This setup allows you to loop through the list without stopping. Knowing how to insert a node into an empty circular linked list is important in
    5 min read
  • Sorted insert for circular linked list
    Given a sorted Circular Linked List. The task is to insert the given data in a sorted way. Examples: Input: Output: Explanation: 8 is inserted after 7 and before 9 to preserve the sorted order. Input: Output: Explanation: 1 will be inserted at the beginning of circular linked list. Approach: To inse
    10 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences