Implementaion of Double LinkList
Implementaion of Double LinkList
#include <iostream>
#include <stdlib.h>
using namespace std;
int i = 0;
} node;
// Allocating memory
// to the Node ptr
node* ptr
= (node*)malloc(sizeof(node));
cout <<"\n";
}
// Allocating memory
// to the Node ptr
node* ptr
= (node*)malloc(sizeof(node));
// If head is NULL
if (head == NULL) {
first = ptr;
first = head;
tail = head;
}
// Allocating memory
// to the Node ptr
node* ptr
= (node*)malloc(sizeof(node));
// If head is NULL
if (head == NULL) {
first = ptr;
first = head;
tail = head;
}
// If invalid position
if (pos < 1 || pos > i + 1) {
cout <<"Please enter a"
" valid position\n";
}
// If position is 1, then
// call delatbegin()
else if (pos == 1) {
delatbegin();
}
// Driver Code
int main()
{
// Adding node to the linked List
addnode(2);
addnode(4);
addnode(9);
addnode(1);
addnode(21);
addnode(22);
cout <<"\n";
cout <<"\n";
return 0;
}