Rename CLL.C to CircularLinkedList.C

This commit is contained in:
Shubham Sah 2020-05-18 15:38:30 +05:30 committed by GitHub
parent 104bf2cafc
commit a3e1817738
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,20 +1,20 @@
/* Circularly Linked List (Basic Operations) - Program to create a Circularly linked list abstract data type and perform various operations on it (Variable first and last declared globally) */
/* Circularly Linked List (Basic Operations) - Program to create a Circularly linked list abstract data type and perform various operations on it (Variable first and last declared globally) */
#include <stdio.h>
#include <conio.h>
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#define NULL 0
#define NULL 0
/* Assume that the data portion of each node consists of ONLY an integer.*/
/* Assume that the data portion of each node consists of ONLY an integer.*/
struct node
{
int data ;
struct node *next ;
} ;
struct node *first=NULL ;
struct node *last=NULL ;
/* first and last are global variables and need not be passed to any function. Any changes made to variables first and last by any of the functions in the program will be reflected in the entire program */
struct node *first=NULL ;
struct node *last=NULL ;
/* first and last are global variables and need not be passed to any function. Any changes made to variables first and last by any of the functions in the program will be reflected in the entire program */
/* This function is responsible for creating the Circularly Linked List right from the BEGINING. */
void create()
@ -54,15 +54,15 @@ void deletenode(int k)
{
struct node *p , *follow ;
/* searching the required node */
p=first ;
follow=NULL ;
while(follow!=last)
{
if(p->data==k)
break ;
follow=p ;
p=p->next ;
/* searching the required node */
p=first ;
follow=NULL ;
while(follow!=last)
{
if(p->data==k)
break ;
follow=p ;
p=p->next ;
}
if(follow==last)
@ -82,7 +82,7 @@ void deletenode(int k)
last->next=first ;
}
else /* deleting any other node */
follow->next=p->next ;
follow->next=p->next ;
free(p) ;
}
@ -96,7 +96,7 @@ void traverse()
printf("Circularly Linked List Empty") ;
else
{
printf("Circularly Linked List is as shown: \n") ;
printf("Circularly Linked List is as shown: \n") ;
p=first ;
follow = NULL ;
@ -105,7 +105,7 @@ void traverse()
printf("%d " , p->data) ;
follow=p ;
p=p->next ;
}
}
printf("\n") ;
}
@ -146,10 +146,10 @@ void main()
break ;
}
}
while(ch!=4) ;
while(ch!=4) ;
getch() ;
}