SlideShare a Scribd company logo
Application of linked list
• Polynomial ADT
• Radix ADT
• Multilist
Polynomial ADT:
We can perform the polynomial
manipulations such as addition, subtraction and
differentiation etc,.
Declaration:
struct poly
{
int coeff;
int power;
struct poly *next;
}*list1,*list2,*list3;
Creation of the polynomial:
poly create(poly *head1,poly *newnode1)
{
poly *ptr;
if(head1==NULL)
{
head1=newnode1;
}
else
{
ptr=head1;
while(ptr->next!=NULL)
ptr=ptr->next;
ptr->next=newnode1;
}
return(head1);
}
Linked list based polynomial addition
void add()
{
poly *ptr1,*ptr2, *newnode;
ptr1=list1;
ptr2=list2;
while(ptr1!=NULL && ptr2!=NULL)
{
newnode=malloc(sizeof(struct poly));
if(ptr1-> power == ptr2-> power)
{
newnode ->coeff=ptr1->coeff+ ptr2->coeff;
newnode-> power = ptr1-> power;
newnode-> next =NULL;
list 3= create(list3, newnode)
ptr1 = ptr1-> next;
ptr2 = ptr2 -> next;
}
else
{
if(ptr1-> power > ptr2--> power)
{
newnode ->coeff=ptr1->coeff;
newnode-> power = ptr1-> power;
newnode-> next =NULL;
list 3= create(list3, newnode)
ptr1 = ptr1-> next;
}
else
{
newnode ->coeff=ptr2->coeff;
newnode-> power = ptr2-> power;
newnode-> next =NULL;
list 3= create(list3, newnode)
ptr2 = ptr2-> next;
}
}
}
Example
Input: 1st number =
5x^2 + 4x^1 + 2x^0
2nd number =
5x^1 + 5x^0
Output: 5x^2 + 9x^1 + 7x^0
Input: 1st number = 5x^3 +
4x^2 + 2x^0
2nd number = 5x^1 + 5x^0
Output: 5x^3 + 4x^2 + 5x^1
+ 7x^0
Linked list based polynomial
Subtraction
void sub()
{
poly *ptr1,*ptr2, *newnode;
ptr1=list1;
ptr2=list2;
while(ptr1!=NULL && ptr2!=NULL)
{
newnode=malloc(sizeof(struct poly));
if(ptr1-> power == ptr2-> power)
{
newnode ->coeff=ptr1->coeff - ptr2->coeff;
newnode-> power = ptr1-> power;
newnode-> next =NULL;
list 3= create(list3, newnode)
ptr1 = ptr1-> next;
ptr2 = ptr2 -> next;
}
else
{
if(ptr1-> power > ptr2-> power)
{
newnode ->coeff=ptr1->coeff;
newnode-> power = ptr1-> power;
newnode-> next =NULL;
list 3= create(list3, newnode)
ptr1 = ptr1-> next;
}
else
{
newnode ->coeff=ptr2->coeff;
newnode-> power = ptr2-> power;
newnode-> next =NULL;
list 3= create(list3, newnode)
ptr2 = ptr2-> next;
}
}
}
Poly * multiply()
{
Node *ptr1, *ptr2,*Newnode;
ptr1 = list1;
ptr2 = list2;
while (ptr1 != NULL)
{
while (ptr2 != NULL)
{
Newnode->coeff = ptr1->coeff * ptr2->coeff;
Newnode->power = ptr1->power + ptr2->power;
list2=create(list3,Newnode);
ptr2 = ptr2->next;
}
ptr2 = list2;
ptr1 = ptr1->next;
}
}
Radix Sort:
• Radix sort is one of the sorting algorithms used
to sort a list of integer numbers in order. In
radix sort algorithm, a list of integer numbers
will be sorted based on the digits of individual
numbers.
• Radix sort algorithm requires the number of
passes which are equal to the number of digits
present in the largest number among the list of
numbers.
• For example, if the largest number is a 3 digit
number then that list is sorted with 3 passes.
Multi-Linked Lists
• A multilinked list is a more general linked list
with multiple links from nodes.
• In a general multi-linked list each node can
have any number of pointers to other nodes,
• Multi-lists are essentially the technique of
embedding multiple lists into a single data
structure.
• A multi-list has more than one next pointer,
like a doubly linked list, but the pointers
create separate lists

More Related Content

What's hot

Statistics - ArgMax Equation
Statistics - ArgMax EquationStatistics - ArgMax Equation
Statistics - ArgMax Equation
Andrew Ferlitsch
 
Numpy
NumpyNumpy
Numpy
ToniyaP1
 
Ds0601 stack
Ds0601 stackDs0601 stack
Ds0601 stack
virajrana
 
Hashing PPT
Hashing PPTHashing PPT
Hashing PPT
Saurabh Kumar
 
Numpy
NumpyNumpy
Hashing
HashingHashing
Hashing
grahamwell
 
Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure
Anand Ingle
 
Hashing notes data structures (HASHING AND HASH FUNCTIONS)
Hashing notes data structures (HASHING AND HASH FUNCTIONS)Hashing notes data structures (HASHING AND HASH FUNCTIONS)
Hashing notes data structures (HASHING AND HASH FUNCTIONS)
Kuntal Bhowmick
 
Data Structure and Algorithms Hashing
Data Structure and Algorithms HashingData Structure and Algorithms Hashing
Data Structure and Algorithms Hashing
ManishPrajapati78
 
Smalltalk
SmalltalkSmalltalk
Smalltalk
Damien Cassou
 
Hash table
Hash tableHash table
Hash table
Rajendran
 
Hashing
HashingHashing
Hashing
amoldkul
 
Ds 8
Ds 8Ds 8
Ds 8
Niit Care
 
Heapsort quick sort
Heapsort quick sortHeapsort quick sort
Heapsort quick sort
Dr Sandeep Kumar Poonia
 
Hashing
HashingHashing
Hashing
debolina13
 
Heapsort using Heap
Heapsort using HeapHeapsort using Heap
Heapsort using Heap
Mohamed Fawzy
 
Heaps
HeapsHeaps
Array & string
Array & stringArray & string
Array & string
Prabhu Govind
 
Lec16
Lec16Lec16
4.4 external hashing
4.4 external hashing4.4 external hashing
4.4 external hashing
Krish_ver2
 

What's hot (20)

Statistics - ArgMax Equation
Statistics - ArgMax EquationStatistics - ArgMax Equation
Statistics - ArgMax Equation
 
Numpy
NumpyNumpy
Numpy
 
Ds0601 stack
Ds0601 stackDs0601 stack
Ds0601 stack
 
Hashing PPT
Hashing PPTHashing PPT
Hashing PPT
 
Numpy
NumpyNumpy
Numpy
 
Hashing
HashingHashing
Hashing
 
Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure
 
Hashing notes data structures (HASHING AND HASH FUNCTIONS)
Hashing notes data structures (HASHING AND HASH FUNCTIONS)Hashing notes data structures (HASHING AND HASH FUNCTIONS)
Hashing notes data structures (HASHING AND HASH FUNCTIONS)
 
Data Structure and Algorithms Hashing
Data Structure and Algorithms HashingData Structure and Algorithms Hashing
Data Structure and Algorithms Hashing
 
Smalltalk
SmalltalkSmalltalk
Smalltalk
 
Hash table
Hash tableHash table
Hash table
 
Hashing
HashingHashing
Hashing
 
Ds 8
Ds 8Ds 8
Ds 8
 
Heapsort quick sort
Heapsort quick sortHeapsort quick sort
Heapsort quick sort
 
Hashing
HashingHashing
Hashing
 
Heapsort using Heap
Heapsort using HeapHeapsort using Heap
Heapsort using Heap
 
Heaps
HeapsHeaps
Heaps
 
Array & string
Array & stringArray & string
Array & string
 
Lec16
Lec16Lec16
Lec16
 
4.4 external hashing
4.4 external hashing4.4 external hashing
4.4 external hashing
 

Similar to DS - Application of List

Ll.pptx
Ll.pptxLl.pptx
Ll.pptx
chin463670
 
linked list.pptx
linked list.pptxlinked list.pptx
linked list.pptx
chin463670
 
Change the driver file (the main .cpp) so that it asks the user to e.pdf
Change the driver file (the main .cpp) so that it asks the user to e.pdfChange the driver file (the main .cpp) so that it asks the user to e.pdf
Change the driver file (the main .cpp) so that it asks the user to e.pdf
fatoryoutlets
 
Linked List.pptx
Linked List.pptxLinked List.pptx
Linked List.pptx
PoonamPatil120
 
3.linked list
3.linked list3.linked list
3.linked list
Chandan Singh
 
How do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdfHow do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdf
feelinggift
 
Linked lists a
Linked lists aLinked lists a
Linked lists a
Khuram Shahzad
 
COMP2710: Software Construction - Linked list exercises
COMP2710: Software Construction - Linked list exercisesCOMP2710: Software Construction - Linked list exercises
COMP2710: Software Construction - Linked list exercises
Xiao Qin
 
Lecture 4 data structures and algorithms
Lecture 4 data structures and algorithmsLecture 4 data structures and algorithms
Lecture 4 data structures and algorithms
Aakash deep Singhal
 
dynamicList.ppt
dynamicList.pptdynamicList.ppt
dynamicList.ppt
ssuser0be977
 
Unit - 2.pdf
Unit - 2.pdfUnit - 2.pdf
Unit - 2.pdf
AravindAnand21
 
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdfC++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
poblettesedanoree498
 
Linked list
Linked listLinked list
Linked list
A. S. M. Shafi
 
DSA(1).pptx
DSA(1).pptxDSA(1).pptx
DSA(1).pptx
DaniyalAli81
 
In C++ I need help with this method that Im trying to write fillLi.pdf
In C++ I need help with this method that Im trying to write fillLi.pdfIn C++ I need help with this method that Im trying to write fillLi.pdf
In C++ I need help with this method that Im trying to write fillLi.pdf
fantoosh1
 
Unit7 C
Unit7 CUnit7 C
Unit7 C
arnold 7490
 
Team 10
Team 10Team 10
Doublylinklist
DoublylinklistDoublylinklist
Doublylinklist
ritu1806
 
Consider a double-linked linked list implementation with the followin.pdf
Consider a double-linked linked list implementation with the followin.pdfConsider a double-linked linked list implementation with the followin.pdf
Consider a double-linked linked list implementation with the followin.pdf
sales98
 
This assignment and the next (#5) involve design and development of a.pdf
This assignment and the next (#5) involve design and development of a.pdfThis assignment and the next (#5) involve design and development of a.pdf
This assignment and the next (#5) involve design and development of a.pdf
EricvtJFraserr
 

Similar to DS - Application of List (20)

Ll.pptx
Ll.pptxLl.pptx
Ll.pptx
 
linked list.pptx
linked list.pptxlinked list.pptx
linked list.pptx
 
Change the driver file (the main .cpp) so that it asks the user to e.pdf
Change the driver file (the main .cpp) so that it asks the user to e.pdfChange the driver file (the main .cpp) so that it asks the user to e.pdf
Change the driver file (the main .cpp) so that it asks the user to e.pdf
 
Linked List.pptx
Linked List.pptxLinked List.pptx
Linked List.pptx
 
3.linked list
3.linked list3.linked list
3.linked list
 
How do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdfHow do you stop infinite loop Because I believe that it is making a.pdf
How do you stop infinite loop Because I believe that it is making a.pdf
 
Linked lists a
Linked lists aLinked lists a
Linked lists a
 
COMP2710: Software Construction - Linked list exercises
COMP2710: Software Construction - Linked list exercisesCOMP2710: Software Construction - Linked list exercises
COMP2710: Software Construction - Linked list exercises
 
Lecture 4 data structures and algorithms
Lecture 4 data structures and algorithmsLecture 4 data structures and algorithms
Lecture 4 data structures and algorithms
 
dynamicList.ppt
dynamicList.pptdynamicList.ppt
dynamicList.ppt
 
Unit - 2.pdf
Unit - 2.pdfUnit - 2.pdf
Unit - 2.pdf
 
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdfC++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
 
Linked list
Linked listLinked list
Linked list
 
DSA(1).pptx
DSA(1).pptxDSA(1).pptx
DSA(1).pptx
 
In C++ I need help with this method that Im trying to write fillLi.pdf
In C++ I need help with this method that Im trying to write fillLi.pdfIn C++ I need help with this method that Im trying to write fillLi.pdf
In C++ I need help with this method that Im trying to write fillLi.pdf
 
Unit7 C
Unit7 CUnit7 C
Unit7 C
 
Team 10
Team 10Team 10
Team 10
 
Doublylinklist
DoublylinklistDoublylinklist
Doublylinklist
 
Consider a double-linked linked list implementation with the followin.pdf
Consider a double-linked linked list implementation with the followin.pdfConsider a double-linked linked list implementation with the followin.pdf
Consider a double-linked linked list implementation with the followin.pdf
 
This assignment and the next (#5) involve design and development of a.pdf
This assignment and the next (#5) involve design and development of a.pdfThis assignment and the next (#5) involve design and development of a.pdf
This assignment and the next (#5) involve design and development of a.pdf
 

More from MythiliMurugan3

DS - Quick Sort
DS - Quick SortDS - Quick Sort
DS - Quick Sort
MythiliMurugan3
 
DS - Graph Traversal
DS - Graph TraversalDS - Graph Traversal
DS - Graph Traversal
MythiliMurugan3
 
DS- Stack ADT
DS- Stack ADTDS- Stack ADT
DS- Stack ADT
MythiliMurugan3
 
DS - BST
DS - BSTDS - BST
DS - BST
MythiliMurugan3
 
DBMS - Relational Algebra
DBMS - Relational AlgebraDBMS - Relational Algebra
DBMS - Relational Algebra
MythiliMurugan3
 
DBMS - Distributed Databases
DBMS - Distributed DatabasesDBMS - Distributed Databases
DBMS - Distributed Databases
MythiliMurugan3
 
DBMS - RAID
DBMS - RAIDDBMS - RAID
DBMS - RAID
MythiliMurugan3
 
DBMS - Transactions
DBMS - TransactionsDBMS - Transactions
DBMS - Transactions
MythiliMurugan3
 
DBMS - ER Model
DBMS - ER ModelDBMS - ER Model
DBMS - ER Model
MythiliMurugan3
 

More from MythiliMurugan3 (9)

DS - Quick Sort
DS - Quick SortDS - Quick Sort
DS - Quick Sort
 
DS - Graph Traversal
DS - Graph TraversalDS - Graph Traversal
DS - Graph Traversal
 
DS- Stack ADT
DS- Stack ADTDS- Stack ADT
DS- Stack ADT
 
DS - BST
DS - BSTDS - BST
DS - BST
 
DBMS - Relational Algebra
DBMS - Relational AlgebraDBMS - Relational Algebra
DBMS - Relational Algebra
 
DBMS - Distributed Databases
DBMS - Distributed DatabasesDBMS - Distributed Databases
DBMS - Distributed Databases
 
DBMS - RAID
DBMS - RAIDDBMS - RAID
DBMS - RAID
 
DBMS - Transactions
DBMS - TransactionsDBMS - Transactions
DBMS - Transactions
 
DBMS - ER Model
DBMS - ER ModelDBMS - ER Model
DBMS - ER Model
 

Recently uploaded

A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
IJNSA Journal
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
nooriasukmaningtyas
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
JamalHussainArman
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
camseq
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
ihlasbinance2003
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
171ticu
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
co23btech11018
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
171ticu
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
KrishnaveniKrishnara1
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball playEric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
enizeyimana36
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
MIGUELANGEL966976
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
Rahul
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
gerogepatton
 

Recently uploaded (20)

A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball playEric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
 

DS - Application of List

  • 1. Application of linked list • Polynomial ADT • Radix ADT • Multilist
  • 2. Polynomial ADT: We can perform the polynomial manipulations such as addition, subtraction and differentiation etc,. Declaration: struct poly { int coeff; int power; struct poly *next; }*list1,*list2,*list3;
  • 3. Creation of the polynomial: poly create(poly *head1,poly *newnode1) { poly *ptr; if(head1==NULL) { head1=newnode1; }
  • 5. Linked list based polynomial addition void add() { poly *ptr1,*ptr2, *newnode; ptr1=list1; ptr2=list2; while(ptr1!=NULL && ptr2!=NULL) { newnode=malloc(sizeof(struct poly));
  • 6. if(ptr1-> power == ptr2-> power) { newnode ->coeff=ptr1->coeff+ ptr2->coeff; newnode-> power = ptr1-> power; newnode-> next =NULL; list 3= create(list3, newnode) ptr1 = ptr1-> next; ptr2 = ptr2 -> next; }
  • 7. else { if(ptr1-> power > ptr2--> power) { newnode ->coeff=ptr1->coeff; newnode-> power = ptr1-> power; newnode-> next =NULL; list 3= create(list3, newnode) ptr1 = ptr1-> next; }
  • 8. else { newnode ->coeff=ptr2->coeff; newnode-> power = ptr2-> power; newnode-> next =NULL; list 3= create(list3, newnode) ptr2 = ptr2-> next; } } }
  • 9. Example Input: 1st number = 5x^2 + 4x^1 + 2x^0 2nd number = 5x^1 + 5x^0 Output: 5x^2 + 9x^1 + 7x^0 Input: 1st number = 5x^3 + 4x^2 + 2x^0 2nd number = 5x^1 + 5x^0 Output: 5x^3 + 4x^2 + 5x^1 + 7x^0
  • 10. Linked list based polynomial Subtraction void sub() { poly *ptr1,*ptr2, *newnode; ptr1=list1; ptr2=list2; while(ptr1!=NULL && ptr2!=NULL) { newnode=malloc(sizeof(struct poly));
  • 11. if(ptr1-> power == ptr2-> power) { newnode ->coeff=ptr1->coeff - ptr2->coeff; newnode-> power = ptr1-> power; newnode-> next =NULL; list 3= create(list3, newnode) ptr1 = ptr1-> next; ptr2 = ptr2 -> next; }
  • 12. else { if(ptr1-> power > ptr2-> power) { newnode ->coeff=ptr1->coeff; newnode-> power = ptr1-> power; newnode-> next =NULL; list 3= create(list3, newnode) ptr1 = ptr1-> next; }
  • 13. else { newnode ->coeff=ptr2->coeff; newnode-> power = ptr2-> power; newnode-> next =NULL; list 3= create(list3, newnode) ptr2 = ptr2-> next; } } }
  • 14. Poly * multiply() { Node *ptr1, *ptr2,*Newnode; ptr1 = list1; ptr2 = list2; while (ptr1 != NULL) { while (ptr2 != NULL) { Newnode->coeff = ptr1->coeff * ptr2->coeff;
  • 15. Newnode->power = ptr1->power + ptr2->power; list2=create(list3,Newnode); ptr2 = ptr2->next; } ptr2 = list2; ptr1 = ptr1->next; } }
  • 16. Radix Sort: • Radix sort is one of the sorting algorithms used to sort a list of integer numbers in order. In radix sort algorithm, a list of integer numbers will be sorted based on the digits of individual numbers. • Radix sort algorithm requires the number of passes which are equal to the number of digits present in the largest number among the list of numbers. • For example, if the largest number is a 3 digit number then that list is sorted with 3 passes.
  • 17.
  • 18. Multi-Linked Lists • A multilinked list is a more general linked list with multiple links from nodes. • In a general multi-linked list each node can have any number of pointers to other nodes, • Multi-lists are essentially the technique of embedding multiple lists into a single data structure. • A multi-list has more than one next pointer, like a doubly linked list, but the pointers create separate lists