// Node of a doubly linked list
class Node {
public:
int data;
// Pointer to next node in DLL
Node* next;
// Pointer to previous node in DLL
Node* prev;
};
// Node of a doubly linked list
struct Node {
int data;
// Pointer to next node in DLL
struct Node* next;
// Pointer to previous node in DLL
struct Node* prev;
};
// Class for Doubly Linked List
public class DLL {
// Head of list
Node head;
// Doubly Linked list Node
class Node {
int data;
Node prev;
Node next;
// Constructor to create a new node
// next and prev is by default initialized as null
Node(int d) { data = d; }
}
}
# Node of a doubly linked list
class Node:
def __init__(self, next=None, prev=None, data=None):
# reference to next node in DLL
self.next = next
# reference to previous node in DLL
self.prev = prev
self.data = data
// Class for Doubly Linked List
public class DLL {
// head of list
Node head;
// Doubly Linked list Node
public class Node {
public int data;
public Node prev;
public Node next;
// Constructor to create a new node
// next and prev is by default initialized as null
Node(int d) { data = d; }
}
}
<script>
// Class for Doubly Linked List
var head; // head of list
/* Doubly Linked list Node */
class Node {
// Constructor to create a new node
// next and prev is by default initialized as null
constructor(val) {
this.data = val;
this.prev = null;
this.next = null;
}
}
</script>