Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
9 views
Doubly Linked List
Code for doubly linked list
Uploaded by
Thanos
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download now
Download
Save Doubly linked list For Later
Download
Save
Save Doubly linked list For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
9 views
Doubly Linked List
Code for doubly linked list
Uploaded by
Thanos
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download now
Download
Save Doubly linked list For Later
Carousel Previous
Carousel Next
Save
Save Doubly linked list For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 3
Search
Fullscreen
#include <stdio.
h> printf("Enter value: ");
#include <stdlib.h> scanf("%d", &val);
struct node { printf("Enter location: ");
int data; scanf("%d", &loc);
struct node *next, *prev; inS(val, loc);
} *head = NULL; break;
void inB(int val); case 4:
void inE(int val); deB();
void inS(int val, int loc); break;
void deB(); case 5:
void deE(); deE();
void deS(int loc); break;
void dis(); case 6:
int main() { printf("Enter location: ");
int ch, val, loc; scanf("%d", &loc);
for (;;) { deS(loc);
printf("\nA.Insert:\t1.At Beginning\t2.At End\t3.At break;
Specific Location");
case 7:
printf("\nB.Delete:\t4.At Beginning\t5.At End\t6.At
dis();
Specific Location");
break;
printf("\n7.Display\t8.Exit\tChoice: ");
case 8:
scanf("%d", &ch);
return 0;
switch (ch) {
default:
case 1:
printf("Invalid input");
printf("Enter value: ");
}
scanf("%d", &val);
}
inB(val);
}
break;
void inB(int val) {
case 2:
struct node *newnode = (struct node
printf("Enter value: ");
*)malloc(sizeof(struct node));
scanf("%d", &val);
newnode->data = val;
inE(val);
newnode->prev = NULL;
break;
newnode->next = head;
case 3:
if (head != NULL)
head->prev = newnode; if (temp == NULL) {
head = newnode; printf("Invalid location. The position is beyond
the list length.\n");
}
free(newnode);
void inE(int val) {
return;
struct node *newnode = (struct node
*)malloc(sizeof(struct node)); }
newnode->data = val; }
newnode->next = NULL;
if (head == NULL) { newnode->next = temp->next;
newnode->prev = NULL; newnode->prev = temp;
head = newnode;
} else { if (temp->next != NULL)
struct node *temp = head; temp->next->prev = newnode;
while (temp->next != NULL)
temp = temp->next; temp->next = newnode;
newnode->prev = temp; }
temp->next = newnode; void deB() {
} if (head == NULL) {
} printf("Empty List\n");
void inS(int val, int loc) { return;
struct node *newnode = (struct node }
*)malloc(sizeof(struct node));
struct node *temp = head;
newnode->data = val;
head = head->next;
if (loc == 1) {
if (head != NULL)
newnode->next = head;
head->prev = NULL;
newnode->prev = NULL;
free(temp);
if (head != NULL)
}
head->prev = newnode;
void deE() {
head = newnode;
if (head == NULL) {
return;
printf("Empty List\n");
}
return;
struct node *temp = head;
}
for (int i = 1; i < loc - 1; i++) {
struct node *temp = head;
temp = temp->next;
if (head->next == NULL) {
head = NULL; }
} else { void dis() {
while (temp->next != NULL) if (head == NULL) {
temp = temp->next; printf("Empty List\n");
temp->prev->next = NULL; } else {
} struct node *temp = head;
free(temp); printf("List: NULL<---");
} while (temp != NULL) {
void deS(int loc) { printf("%d", temp->data);
if (head == NULL) { if (temp->next != NULL)
printf("Empty List\n"); printf("<===>");
return; temp = temp->next;
} }
struct node *temp = head; printf("--->NULL\n");
if (loc == 1) { }
head = temp->next; }
if (head != NULL)
head->prev = NULL;
free(temp);
return;
}
for (int i = 1; i < loc; i++) {
temp = temp->next;
if (temp == NULL) {
printf("Invalid location. The position is beyond
the list length.\n");
return;
}
}
if (temp->next != NULL)
temp->next->prev = temp->prev;
if (temp->prev != NULL)
temp->prev->next = temp->next;
free(temp);
You might also like
Instruction Book ZT145
PDF
80% (5)
Instruction Book ZT145
54 pages
Sample Test MTCNA 100 PDF
PDF
0% (1)
Sample Test MTCNA 100 PDF
3 pages
Acer PDF
PDF
No ratings yet
Acer PDF
16 pages
General Specification For Building Maintenance Works in Residential Buildings
PDF
100% (2)
General Specification For Building Maintenance Works in Residential Buildings
321 pages
Circular Linked List
PDF
No ratings yet
Circular Linked List
4 pages
DS Prgms
PDF
No ratings yet
DS Prgms
62 pages
DS_labmanual
PDF
No ratings yet
DS_labmanual
34 pages
Linked Lists
PDF
No ratings yet
Linked Lists
4 pages
LAB SDA N2 Revenko Ivan-1
PDF
No ratings yet
LAB SDA N2 Revenko Ivan-1
7 pages
Asisignment 4 Code-1-12
PDF
No ratings yet
Asisignment 4 Code-1-12
12 pages
dll
PDF
No ratings yet
dll
5 pages
160123735197
PDF
No ratings yet
160123735197
40 pages
Program 4
PDF
No ratings yet
Program 4
18 pages
DS Lab PGM
PDF
No ratings yet
DS Lab PGM
43 pages
SLL
PDF
No ratings yet
SLL
5 pages
Dsa CH 3 Program
PDF
No ratings yet
Dsa CH 3 Program
12 pages
Linkedlist C
PDF
No ratings yet
Linkedlist C
7 pages
Experiment 10
PDF
No ratings yet
Experiment 10
6 pages
linked.c
PDF
No ratings yet
linked.c
8 pages
CIRCULAR_SLL
PDF
No ratings yet
CIRCULAR_SLL
5 pages
DSA Using C
PDF
No ratings yet
DSA Using C
52 pages
Assignment 6
PDF
No ratings yet
Assignment 6
6 pages
2012020088_B_CSE assignment
PDF
No ratings yet
2012020088_B_CSE assignment
11 pages
Linked List Prgrams
PDF
No ratings yet
Linked List Prgrams
4 pages
A69 DS Ass10
PDF
No ratings yet
A69 DS Ass10
23 pages
SLL_ProgramFunctions
PDF
No ratings yet
SLL_ProgramFunctions
10 pages
202411005_ CS162_1
PDF
No ratings yet
202411005_ CS162_1
22 pages
CLL
PDF
No ratings yet
CLL
9 pages
Circular SinglyLinkedList
PDF
No ratings yet
Circular SinglyLinkedList
10 pages
Link List Program D
PDF
No ratings yet
Link List Program D
22 pages
Doublylinked List Operations
PDF
No ratings yet
Doublylinked List Operations
31 pages
DLL
PDF
No ratings yet
DLL
6 pages
SLL Program
PDF
No ratings yet
SLL Program
11 pages
CTSD C03 &co4
PDF
No ratings yet
CTSD C03 &co4
38 pages
Code 10
PDF
No ratings yet
Code 10
8 pages
Data Structures & Algorithms DA5: Lab Assessment-5
PDF
No ratings yet
Data Structures & Algorithms DA5: Lab Assessment-5
21 pages
Doubly Linked List
PDF
No ratings yet
Doubly Linked List
11 pages
Double LL Ins, Del
PDF
No ratings yet
Double LL Ins, Del
3 pages
Linked List Programs (Single, Double, Circular)
PDF
No ratings yet
Linked List Programs (Single, Double, Circular)
16 pages
DSA Assignment
PDF
No ratings yet
DSA Assignment
8 pages
DS Polynomial Addition
PDF
No ratings yet
DS Polynomial Addition
13 pages
Lab 8
PDF
No ratings yet
Lab 8
8 pages
Exercise 3
PDF
No ratings yet
Exercise 3
23 pages
4 Linkedlist
PDF
No ratings yet
4 Linkedlist
7 pages
Dsa Ela Da 2
PDF
No ratings yet
Dsa Ela Da 2
19 pages
DS Programs
PDF
No ratings yet
DS Programs
13 pages
Dsa Asses4
PDF
No ratings yet
Dsa Asses4
17 pages
Data Structures & Algorithms Lab
PDF
No ratings yet
Data Structures & Algorithms Lab
51 pages
doubly linked list
PDF
No ratings yet
doubly linked list
6 pages
DS Assignment 3
PDF
No ratings yet
DS Assignment 3
5 pages
2021_spring
PDF
No ratings yet
2021_spring
12 pages
Dsaexp 5
PDF
No ratings yet
Dsaexp 5
6 pages
Blank
PDF
No ratings yet
Blank
3 pages
Chrisfred Assignment
PDF
No ratings yet
Chrisfred Assignment
7 pages
EXP-4 & 5
PDF
No ratings yet
EXP-4 & 5
23 pages
CLL
PDF
No ratings yet
CLL
6 pages
Class 8 and Class 9 Demo Programs
PDF
No ratings yet
Class 8 and Class 9 Demo Programs
11 pages
Data Structures Record
PDF
No ratings yet
Data Structures Record
94 pages
Exercise 3 4
PDF
No ratings yet
Exercise 3 4
11 pages
Final dsa lab work
PDF
No ratings yet
Final dsa lab work
25 pages
Lab Assignment - V (Bcac393)
PDF
No ratings yet
Lab Assignment - V (Bcac393)
26 pages
Assignment 7
PDF
No ratings yet
Assignment 7
9 pages
Computer Engineering Laboratory Solution Primer
From Everand
Computer Engineering Laboratory Solution Primer
Karan Bhandari
No ratings yet
PHP programming
From Everand
PHP programming
Nino Paiotta
No ratings yet
What Are End of Line Resistors and Do I Need Them
PDF
No ratings yet
What Are End of Line Resistors and Do I Need Them
3 pages
Gen 12MW PDF
PDF
100% (1)
Gen 12MW PDF
11 pages
Temporary Electrical Service Paragraph Number Title Page Number
PDF
No ratings yet
Temporary Electrical Service Paragraph Number Title Page Number
4 pages
GSM-R Exec Summary 0101
PDF
100% (1)
GSM-R Exec Summary 0101
26 pages
CSC Update Log
PDF
No ratings yet
CSC Update Log
19 pages
Perform Mensuration and Calculation & Prepare and Interpret Technical Drawing
PDF
No ratings yet
Perform Mensuration and Calculation & Prepare and Interpret Technical Drawing
6 pages
1 Indian Air Force
PDF
No ratings yet
1 Indian Air Force
3 pages
Powerfoil x3.0 Install Guide Online
PDF
100% (1)
Powerfoil x3.0 Install Guide Online
88 pages
PPoE Protocol
PDF
No ratings yet
PPoE Protocol
10 pages
9718 VI 2nd Ed Incl Corr Alltext en
PDF
No ratings yet
9718 VI 2nd Ed Incl Corr Alltext en
410 pages
Sas-Sistem de Control
PDF
No ratings yet
Sas-Sistem de Control
56 pages
Pipe Welding
PDF
No ratings yet
Pipe Welding
6 pages
Celebrating Over 30 Years of Manufacturing: "The Reamer People", Turbo and Fabrication
PDF
100% (1)
Celebrating Over 30 Years of Manufacturing: "The Reamer People", Turbo and Fabrication
19 pages
Easergy MiCOM P34x - P343 - M-M - K
PDF
No ratings yet
Easergy MiCOM P34x - P343 - M-M - K
2 pages
Davidson Resume 1
PDF
No ratings yet
Davidson Resume 1
2 pages
Fire Training Manual
PDF
No ratings yet
Fire Training Manual
72 pages
Friction Loss Pipes
PDF
No ratings yet
Friction Loss Pipes
23 pages
Interfacing PB With The Web 1 2 PDF
PDF
No ratings yet
Interfacing PB With The Web 1 2 PDF
4 pages
Technical Information For PERFECTA PREMIUM Line
PDF
No ratings yet
Technical Information For PERFECTA PREMIUM Line
9 pages
Obo Specification - Metal 1.5mm Raceways + JBM + Gesx + Service Pole
PDF
No ratings yet
Obo Specification - Metal 1.5mm Raceways + JBM + Gesx + Service Pole
2 pages
Setting Expectations
PDF
No ratings yet
Setting Expectations
13 pages
PT Cruiser 06pt
PDF
67% (3)
PT Cruiser 06pt
580 pages
Bellows Design FEA
PDF
No ratings yet
Bellows Design FEA
9 pages
Ra 450-505 SXF 2007-E
PDF
100% (1)
Ra 450-505 SXF 2007-E
132 pages
Busbar Legrand
PDF
No ratings yet
Busbar Legrand
162 pages
Sydney 2000 Olympic Games: A Project Management Perspective
PDF
0% (1)
Sydney 2000 Olympic Games: A Project Management Perspective
6 pages