IMPLEMENTION OF THE LIST ADT USING ARRAYS
#include<iostream>
#define MAX 10
using namespace std;
class arrayadt
{
public:
         int a,i,size,n,p,e,f,pos,b[20],x;
void create()
{
cout<<"Creating a list"<<endl;
cout<<"Enter the size of the array:";
cin>>size;
for(i=0;i<size;i++)
{
cin>>b[i];
}
}
//cout<<endl;
void Isfull()
{
if(size==0)
{
cout<<"The array is empty:"<<endl;
}
else
{
cout<<"The array is full:"<<endl;
}
}
//cout<<endl;
void Isempty()
{
if(size==0)
{
cout<<"The array is empty"<<endl;
}
else
{
cout<<"The array is full"<<endl;
}
}
void Insert()
{
cout<<"Enter the position of the array for the element to be inserted:";
cin>>pos;
if(pos>=size)
{
cout<<"Invalid position"<<endl;
}
else
{
for(i=MAX;i>=pos;i--)
{
b[i]=b[i-1];
}
cout<<"Enter the element to be inserted:";
cin>>p;
b[pos]=p;
size++;
}
cout<<"List after insertion"<<endl;
for(i=0;i<size;i++)
{
cout<<b[i]<<"\t";
}
}
void Delete()
{
cout<<"\nEnter the position of the array for the element to be deleted:";
cin>>pos;
if(pos>=size)
{
cout<<"Invalid position"<<endl;
}
else
{
for(i=pos+1;i<size;i++)
{b[i-1]=b[i];
}
size--;
}
cout<<"The list after deletion"<<endl;
for(i=0;i<size;i++)
{
cout<<b[i]<<"\t";
}
}
void Find()
{
cout<<"\nEnter the element to be searched:";
cin>>x;
for(i=0;i<size;i++)
{
if(b[i]==x)
{
cout<<"Element is at position:"<<i<<endl;
}
}
}
void print()
{
cout<<"The final array"<<endl;
for(i=0;i<size;i++)
{
cout<<b[i]<<"\t";
}
}
};
int main()
{
arrayadt obj;
int ch;
do{
  cout<<"\n\t\t OPERATIONS IN LIST ADT USING ARRAY";
  cout<<"\n 1.creation\n2.insretion\n3.delection\n4.find \n5.display \n 6.exit";
  cout<<"\nENTER YOUR CHIOCE";
  cin>>ch;
  switch(ch)
{
case 1:
obj.create();
break;
case 2:
obj.Insert();
break;
case 3:
obj.Delete();
break;
case 4:
obj.Find();
break;
case 5:
obj.print();
break;
default: exit(0);
return 0;
}
}while(ch<6);
}
       IMPLEMENTION OF THE DOUBLY LINKED LIST.
#include<iostream>
using namespace std;
class dou
{
struct node
{
 node *back;
 int data;
 node *next;
 } *head,*start,*last,*temp,*temp1;
 int count;
 public:
   dou()
   {
   count=0;
   start=NULL;
   }
   void cre();
   void ins();
   void del();
   int front();
   void view();
};
void dou::cre()
{
 int ch;
 if(count==0)
 {
 cout<<"\n ENTER THE NUMBER OF NODES";
 cin>>ch;
 cout<<"ENTER THE VALUES:";
 for(int j=0;j<ch;j++)
 {
 head=new node;
 cin>>head->data;
 head->next=NULL;
 head->next=NULL;
 if(j==0)
 start=head;
 else
 {
 head->back=last;
 last->next=head;
}
last=head;
count++;
}
}
else
cout<<"\n ALREADY LIST CREATED";
}
void dou::ins()
{
int ch;
if(count==0)
{
cout<<"\n CREATED LIST FIRST";
return;
}
else
{
view();
cout<<"\n 1.AT.BEGIN\n2.IN MIDDLE\n3.AT END";
cin>>ch;
if(ch==1)
{
head=new node;
cout<<"\n ENTER THE VALUES:";
cin>>head->data;
head->back=NULL;
head->next=start;
start=head;
count++;
}
if(ch==2)
{
int p;
head=new node;
temp=temp1=start;
cout<<"\n ENTER THE POSITION:";
cin>>p;
cout<<"ENTER THE VALUES:";
cin>>head->data;
for(int i=1;i<p-1;i++)
temp=temp->next;
temp1=temp->next;
head->back=temp;
temp->next=head;
head->next=temp1;
temp1->back=head;
count++;
}
}
if(ch==3)
{
head=new node;
cout<<"ENTER THE VALUES:";
cin>>head->data;
head->next=NULL;
head->back=last;
last=head;
count++;
}
}
void dou::del()
{
  int ch;
  if(count==0)
  {
  cout<<"\n LIST IS EMPTY\n";
  return;
  }
  else
  {
  view();
  cout<<"\n 1.AT BEGIN\n2.AT MIDDLE\n3.AT END";
  cin>>ch;
  if(ch==1)
  {
  cout<<"\n DELETED VALUE";
  cout<<start->data;
  start=start->next;
  start->back=NULL;
  count--;
}
if(ch==2)
{
 int p;
 temp=start;
 cout<<"\n ENTER THE POSITION";
 cin>>p;
 cout<<"\nDELETED VALUES";
 for(int i=1;i<p-1;i++)
  temp=temp->next;
  temp1=temp->next;
 if(count==1)
   cout<<start->data;
 else
   cout<<temp1->data;
   temp1=temp1->next;
   temp->next=temp1;
   temp1->back=temp;
   count--;
   }
 }
 if(ch==3)
 {
   cout<<"\n DELETED VALUE";
   cout<<last->data;
   last=last->back;
   last->next=NULL;
   count--;
   if(count==0)
   start=NULL;
   }
 }
 void dou::view()
 {
 temp=start;
 if(temp==NULL)
 {
   cout<<"\n LIST IS EMPTY\n\t";
   return;
 }
    cout<<"\n LIST ELEMENTS ARE:";
    while(temp!=NULL)
    {
    cout<<temp->data;
    if(temp->next!=NULL)
  cout<<"<==>";
  temp=temp->next;
  }
}
int dou::front()
{
  int ch;
  cout<<"\n\t\t OPERATIONS IN DOUBLY LINKED LIST";
  cout<<"\n 1.creation\n2.insretion\n3.delection\n4.view\n5.exit";
  cout<<"\nENTER YOUR CHIOCE";
  cin>>ch;
  return ch;
}
int main()
{
dou d;
while(1)
{
switch(d.front())
{
  case 1: d.cre();break;
  case 2: d.ins();break;
  case 3: d.del();break;
  case 4: d.view();break;
  default: exit(0);
}
}
}