Professional Documents
Culture Documents
Week 6
Week 6
list.
i) Crea on
ii) Inser on
iii) Dele on
iv) Traversal
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
struct node
int data;
};
void deque();
void display();
void main()
int no,ch,e;
scanf("%d",&ch);
switch (ch)
case 1:
scanf("%d",&no);
enque(no);
break;
case 2:
deque();
break;
case 3:display();
break;
scanf("%d",&no);
search(no);
break;
case 5:exit(0);
void enque(int d)
{
temp->data = d;
temp->next=NULL;
if (rear == NULL)
front = temp;
rear=temp;
return;
rear->next=temp;
rear=temp;
void display()
temp = front;
if (front == NULL)
return;
void deque()
if (front==NULL)
return;
front=front->next;
temp=front;
while(temp!=NULL)
if(temp->data==key)
return;
temp=temp->next;
}
prin ("element not found");
OUTPUT:
1 - insert
2 - delete
3 - Dipslay
4 - search
5 - Exit
Enter choice : 1
Enter data : 12
Enter choice : 1
Enter data : 23
Enter choice : 1
Enter data : 34
Enter choice : 3
12 23 34
Enter choice : 2
Enter choice : 3
23 34
Enter choice : 4
element found
Enter choice : 5