15-11-2012, 04:06 PM
DOUBLY LINKED LIST – LINKED LIST IMPLEMENTATION
DOUBLY LINKED LIST – LINKED LIST IMPLEMENTATION.docx (Size: 15.17 KB / Downloads: 28)
Algorithm:
Step 1: Declare header and pointer variables
Step 2: Display the choices
Step 3: If choice is 1 the get the element to be inserted in beginning and call ins_beg function.
Step 4: If choice is 2 the get the element to be inserted in the end and call the ins_end function
Step 5: If choice is 3 then get the element to be deleted and call deletion function.
Step 6: If choice is 4 then call display duncation
Step 7: If choice is default the exit the program
Step 8: Terminate the program execution.
Program:
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void display(struct node *first);
struct node
{
int data;
struct node *lptr,*rptr;
}*head;
struct node *ins_beg(int x,struct node *first)
{
struct node *new1,*cur,*prev;
new1=malloc(sizeof(struct node));