- Managing song playlists in media player applications.
- Managing shopping carts in online shopping.
This article is contributed by Akash Gupta.
Insertion in Doubly Circular Linked List
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.
Following is the representation of a Circular doubly linked list node in C/C++:
C++
static class node {
int data;
node next;
node prev;
}
|
C
struct node {
int data;
struct node* next;
struct node* prev;
};
|
Java
class Node {
int data;
Node next;
Node prev;
}
|
Python
class Node:
def __init__( self ):
self .data = None
self . next = None
self .prev = None
|
C#
public class Node {
public int Data
{
get ;
set ;
}
public Node Next
{
get ;
set ;
}
public Node Prev
{
get ;
set ;
}
}
public class DoublyLinkedList {
}
|
Javascript
class Node {
constructor(data) {
this .data = data;
this .next = null ;
this .prev = null ;
}
}
|
Circular Doubly Linked LIst