#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#include<alloc.h>
{
struct node *llink;
struct node *rlink;
int data;
{
struct node *temp;
temp=q;
int i=0;
while(temp!=null)
{
{
struct node *temp;
int data;
temp=*q;
cout<<"\nenter data to be inserted";
cin>>data;
if(temp==null)
{
// cout<<"\nlinked list is empty ";
temp=(struct node *)(malloc(sizeof(struct node)));
temp->data=data;
temp->llink=null;
temp->rlink=null;
*q=temp;
{
struct node *temp1;
temp1=(struct node *)(malloc(sizeof(struct node)));
temp1->data=data;
temp1->llink=null;
temp1->rlink=temp;
temp->llink=temp1;
*q=temp1;
int data;
cout<<"\nenter data : ";
cin>>data;
temp=*q;
if(temp==null)
{
// cout<<"\nlinked list is empty ";
temp=(struct node *)(malloc(sizeof(struct node)));
temp->data=data;
temp->llink=null;
temp->rlink=null;
*q=temp;
return;
temp=temp->rlink;
struct node *temp1;
temp1=(struct node *)(malloc(sizeof(struct node)));;
temp1->data=data;
temp1->llink=temp;
temp1->rlink=null;
temp->rlink=temp1;
{
int data,loc;
cout<<"\nenter data n location to insert node : ";
cin>>data>>loc;
if(loc<1||loc>count(*q))
{
cout<<"\nnode doesn't exist!!";
getch();
return;
{
addatend(q);
return;
{
addatbeg(q);
return;
}struct node *temp,*temp1,*temp2;
temp=*q;
while(loc!=1)
{
temp=temp->rlink;
loc--;
temp1=temp->rlink;
temp2->data=data;
temp2->llink=temp;
temp2->rlink=temp1;
temp->llink=temp2;
temp->rlink=temp2;
temp1->llink=temp2;
{
int loc;
cout<<"\nenter node no. to delete : ";
cin>>loc;
if(loc==0||loc>count(*q))
{
cout<<"\nnode doesn't exist!!";
getch();
return;
{
*q=temp->rlink;
cout<<"\ndata deleted : "<<temp->data;
delete(temp);
return;
{
while(loc!=2)
{
temp1=temp->rlink;
cout<<"\ndata deleted : "<<temp1->data;
delete(temp1);
temp->rlink=null;
return;
{
while(loc!=2)
{
temp1=temp->rlink;
temp2=temp1->rlink;
cout<<"\ndata deleted : "<<temp1->data;
delete(temp1);
temp->rlink=temp2;
temp2->llink=temp;