Assignment
Assignment
#include<stdio.h>
#include<stdlib.h>
struct NODE{
int data;
};
while(temp!=NULL){
printf("%d->",temp->data);
temp=temp->next;
int main(){
head->data=10;
current->data=20;
ptr->data=30;
head->next=current;
current->next=ptr;
ptr->next=NULL;
print(head);
return 0;
}
Insert Node First
#include<stdio.h>
#include<stdlib.h>
struct NODE{
int data;
};
temp->data=d;
temp->next=head;
head=temp;
return head;
};
int main(){
head->data=20;
current->data=30;
ptr->data=40;
head->next=current;
current->next=ptr;
ptr->next=NULL;
int d=10;
head=add(head,d);
while(head!=NULL){
printf("%d->",head->data);
head=head->next;
return 0;
}
Insert Node First(DOUBLE)
#include<stdio.h>
#include<stdlib.h>
struct NODE{
int data;
};
temp->data=d;
temp->prev=NULL;
temp->next=head;
head->prev=temp;
head=temp;
return head;
};
int main(){
head->data=20;
current->data=30;
ptr->data=40;
head->prev=NULL;
current->prev=head;
ptr->prev=current;
head->next=current;
current->next=ptr;
ptr->next=NULL;
int d=10;
head=add(head,d);
while(head!=NULL){
printf("%d <->",head->data);
head=head->next;
printf("NULL \n");
return 0;
#include<stdlib.h>
struct NODE{
int data;
};
temp->data=d;
temp->next=NULL;
while(ne->next!=NULL){
ne=ne->next;
ne->next=temp;
int main(){
head->data=20;
current->data=30;
ptr->data=40;
head->next=current;
current->next=ptr;
ptr->next=NULL;
int d=10;
add(head,d);
while(head!=NULL){
printf("%d->",head->data);
head=head->next;
return 0;
#include<stdlib.h>
struct NODE{
int data;
};
temp->data=d;
temp->next=NULL;
while(ne->next!=NULL){
ne=ne->next;
ne->next=temp;
temp->prev=ne;
int main(){
head->data=20;
current->data=30;
ptr->data=40;
head->prev=NULL;
current->prev=head;
ptr->prev=current;
head->next=current;
current->next=ptr;
ptr->next=NULL;
int d=10;
add(head,d);
while(head!=NULL){
printf("%d<->",head->data);
head=head->next;
printf("NULL");
return 0;
#include<stdlib.h>
struct NODE{
int data;
};
temp->data=d;
temp->next=NULL;
while(ne->data!=30){
ne=ne->next;
}
temp->next=ne->next;
ne->next=temp;
int main(){
head->data=20;
current->data=30;
ptr->data=40;
head->next=current;
current->next=ptr;
ptr->next=NULL;
int d=10;
add(head,d);
while(head!=NULL){
printf("%d->",head->data);
head=head->next;
return 0;
#include<stdlib.h>
struct NODE{
int data;
};
temp->next=NULL;
while(ne->data!=30){
ne=ne->next;
temp->prev=ne;
temp->next=ne->next;
ne->next=temp;
int main(){
head->data=20;
current->data=30;
ptr->data=40;
head->prev=NULL;
current->prev=head;
ptr->prev=current;
head->next=current;
current->next=ptr;
ptr->next=NULL;
int d=10;
add(head,d);
while(head!=NULL){
printf("%d<->",head->data);
head=head->next;
printf("NULL");
return 0;
#include<stdlib.h>
struct NODE{
int data;
};
if(temp->next==NULL){
}else{
temp=temp->next;
free(p);
head=temp;
return head;
};
int main(){
head->data=20;
current->data=30;
ptr->data=40;
head->next=current;
current->next=ptr;
ptr->next=NULL;
head=delet(head);
while(head!=NULL){
printf("%d->",head->data);
head=head->next;
return 0;
#include<stdlib.h>
struct NODE{
int data;
};
if(temp->next==NULL){
}else{
temp=temp->next;
free(p);
p=NULL;
temp->prev=NULL;
head=temp;
return head;
};
int main(){
head->data=20;
current->data=30;
ptr->data=40;
head->prev=NULL;
current->prev=head;
ptr->prev=current;
head->next=current;
current->next=ptr;
ptr->next=NULL;
head=delet(head);
while(head!=NULL){
printf("%d<->",head->data);
head=head->next;
printf("NULL");
return 0;
#include<stdlib.h>
struct NODE{
int data;
};
if(temp->next==NULL){
}else{
struct NODE* temp1=temp;
while(temp2->next!=NULL){
temp1=temp2;
temp2=temp2->next;
temp1->next=NULL;
free(temp2);
head=temp;
return head;
};
int main(){
head->data=20;
current->data=30;
ptr->data=40;
head->next=current;
current->next=ptr;
ptr->next=NULL;
head=delet(head);
while(head!=NULL){
printf("%d->",head->data);
head=head->next;
return 0;
struct NODE{
int data;
};
if(temp->next==NULL){
}else{
temp=temp->next;
free(p);
p=NULL;
temp->prev=NULL;
head=temp;
return head;
};
int main(){
head->data=20;
current->data=30;
ptr->data=40;
head->prev=NULL;
current->prev=head;
ptr->prev=current;
head->next=current;
current->next=ptr;
ptr->next=NULL;
head=delet(head);
while(head!=NULL){
printf("%d<->",head->data);
head=head->next;
printf("NULL");
return 0;
#include<stdlib.h>
struct NODE{
int data;
};
if(temp->next==NULL){
}else{
while(temp2->data!=40){
temp1=temp2;
temp2=temp2->next;
temp1->next=temp2->next;
free(temp2);
head=temp;
return head;
};
int main(){
head->data=20;
current->data=30;
ptr->data=40;
top->data=50;
head->next=current;
current->next=ptr;
ptr->next=top;
top->next=NULL;
head=delet(head);
while(head!=NULL){
printf("%d->",head->data);
head=head->next;
return 0;
#include<stdlib.h>
struct NODE{
int data;
};
}else{
while(temp2->data!=40){
temp1=temp2;
temp2=temp2->next;
temp1->next=temp2->next;
temp2->prev=NULL;
free(temp2);
head=temp;
return head;
};
int main(){
head->data=20;
current->data=30;
ptr->data=40;
top->data=50;
head->prev=NULL;
current->prev=head;
ptr->prev=current;
top->prev=ptr;
head->next=current;
current->next=ptr;
ptr->next=top;
top->next=NULL;
head=delet(head);
while(head!=NULL){
printf("%d<->",head->data);
head=head->next;
printf("NULL");
return 0;
CIRCULAR LINKLIST(Singly)
#include<stdio.h>
#include<stdlib.h>
struct NODE{
int data;
};
do{
printf("%d->",temp->data);
temp=temp->next;
}while(
temp->next!=p->next
);
int main(){
head->data=10;
current->data=20;
ptr->data=30;
head->next=current;
current->next=ptr;
ptr->next=head;
int NUMBEROFNODE=3;
print(head,NUMBEROFNODE);
return 0;