linkedlist
-
Upload
sathasivam-r -
Category
Documents
-
view
18 -
download
1
Transcript of linkedlist
![Page 1: linkedlist](https://reader036.fdocuments.us/reader036/viewer/2022062406/55be09e8bb61ebb8588b4636/html5/thumbnails/1.jpg)
ASSIGNMENT NO 1DATA STRUCTURE
TEAM 8
TEAM MEMBERS ANAND. S _ 13MX03 DHIVYA. K. S _ 13MX09 KARTHIK. A.R _ 13MX21 MALATHI. A _ 13MX25 YOGESHWARI _ 13MX54
MULTIPLY LINKED LIST
![Page 2: linkedlist](https://reader036.fdocuments.us/reader036/viewer/2022062406/55be09e8bb61ebb8588b4636/html5/thumbnails/2.jpg)
Linked list
•A Linked representation of data structure is known as a linked list, Which is a collection of nodes.
•Each node is a collection of fields categorized as data items and links.
![Page 3: linkedlist](https://reader036.fdocuments.us/reader036/viewer/2022062406/55be09e8bb61ebb8588b4636/html5/thumbnails/3.jpg)
Merits of linked data structure
•Efficient implementation of insertion and deletion operations.
•Efficient usage of storage memory.
![Page 4: linkedlist](https://reader036.fdocuments.us/reader036/viewer/2022062406/55be09e8bb61ebb8588b4636/html5/thumbnails/4.jpg)
Multiple linked list
•In multiple linked list, each node contains
two or more link fields, each field being
used to connect the same set of data
records in a different order.
•Eg : By name, By department etc, . .
![Page 5: linkedlist](https://reader036.fdocuments.us/reader036/viewer/2022062406/55be09e8bb61ebb8588b4636/html5/thumbnails/5.jpg)
MULTIPLY LINKED LIST
Linked representation with multiple data and link fields.
Multiply linked representation of the list L is a network of nodes which are connected to one another based on some associations.
![Page 6: linkedlist](https://reader036.fdocuments.us/reader036/viewer/2022062406/55be09e8bb61ebb8588b4636/html5/thumbnails/6.jpg)
![Page 7: linkedlist](https://reader036.fdocuments.us/reader036/viewer/2022062406/55be09e8bb61ebb8588b4636/html5/thumbnails/7.jpg)
Node structure of a multiply linked list:
…DATA1 DATA2 … DATA X LINK 1
LINK 3
LINK 4
LINK 2LINK m-1
LINK m
![Page 8: linkedlist](https://reader036.fdocuments.us/reader036/viewer/2022062406/55be09e8bb61ebb8588b4636/html5/thumbnails/8.jpg)
EXAMPLE 1: Student details for representation as a multiply linked list
Name of the student
Roll no: No of Credits
Sports Club Membership
Day Student
Department
ARUN MX05 200 YES YES DCA
BABU ME12 210 N0 YES DME
LAKSHMI MX23 210 YES NO DCA
RAM CE40 190 YES NO DCE
GURU CS35 190 NO YES DCS
SREE CE46 220 YES NO DCE
![Page 9: linkedlist](https://reader036.fdocuments.us/reader036/viewer/2022062406/55be09e8bb61ebb8588b4636/html5/thumbnails/9.jpg)
Node structure of the multiply linked list student:
Sports Club Men
Name of Name of the student the Credits
Registered
Roll no
Day Student
Dept Enroll
![Page 10: linkedlist](https://reader036.fdocuments.us/reader036/viewer/2022062406/55be09e8bb61ebb8588b4636/html5/thumbnails/10.jpg)
ARUN MX05 200 YES YES DCA
BABU ME12 210 N0 YES DME
LAKSHMI MX23 210 YES NO DCA
RAM CE40 190 YES NO DCE
SCM - Sports Club Membership
Multiply linked list structure of list student
![Page 11: linkedlist](https://reader036.fdocuments.us/reader036/viewer/2022062406/55be09e8bb61ebb8588b4636/html5/thumbnails/11.jpg)
ARUN MX05 200 YES YES DCA
BABU ME12 210 N0 YES DME
GURU CS35 190 NO YES DCS
DS
DS - DAY STUDENT
LAKSHMI MX23 210 YES NO DCA
SREE CE46 220 YES NO DCE
![Page 12: linkedlist](https://reader036.fdocuments.us/reader036/viewer/2022062406/55be09e8bb61ebb8588b4636/html5/thumbnails/12.jpg)
ARUN MX05 200 YES YES DCA
RAM CE40 190 YES NO DCE
BABU ME12 210 N0 YES DME
D
D- DEPARTMENT NAME
LAKSHMI MX23 210 YES NO DCA
SREE CE46 220 YES NO DCE
GURU CS35 190 NO YES DCS
![Page 13: linkedlist](https://reader036.fdocuments.us/reader036/viewer/2022062406/55be09e8bb61ebb8588b4636/html5/thumbnails/13.jpg)
Insert ALI into the multiply linked list studentALI DCS 200 YES NO DCS
GURU CS35 190 NO YES DCS
ARUN MX05 200 YES YES DCA
BABU ME12 210 N0 YES DME
ALI DCS 200 YES NO DCS
![Page 14: linkedlist](https://reader036.fdocuments.us/reader036/viewer/2022062406/55be09e8bb61ebb8588b4636/html5/thumbnails/14.jpg)
Delete SREE from the Sports Club Membership list from student:BEFORE DELETING :
SREE CE46 220 YES NO DCE
RAM CE40 190 YES NO DCE
AFTER DELETING :
SREE CE46 220 YES NO DCE
RAM CE40 190 YES NO DCE
![Page 15: linkedlist](https://reader036.fdocuments.us/reader036/viewer/2022062406/55be09e8bb61ebb8588b4636/html5/thumbnails/15.jpg)
Example 2Sparse Matrix
The sparse matrix is a matrix with zeros as the dominating elements.
7 8 5 3 4 6 2 1 5 3 2 9 1 4 9 2
7 0 0 0 0 0 0 0 0 0 1 0 0 2 0 0
Matrix Sparse Matrix
![Page 16: linkedlist](https://reader036.fdocuments.us/reader036/viewer/2022062406/55be09e8bb61ebb8588b4636/html5/thumbnails/16.jpg)
Node structure of the multiply linked list:
ROW COL DATA
RIGHT
DOWN
![Page 17: linkedlist](https://reader036.fdocuments.us/reader036/viewer/2022062406/55be09e8bb61ebb8588b4636/html5/thumbnails/17.jpg)
Each non zero element of the matrix is represented using the node structure. Here ROW, COL and DATA fields record the row , column and values of the non zero elements in the matrix. The RIGHT link points to the node holding the next non zero value in the same row of the matrix. The LEFT link points to the node holding the next non zero value in the same column of the matrix.
![Page 18: linkedlist](https://reader036.fdocuments.us/reader036/viewer/2022062406/55be09e8bb61ebb8588b4636/html5/thumbnails/18.jpg)
Applications of multiply linked list
•Addition of polynomials
•Representation of sparse matrix
![Page 19: linkedlist](https://reader036.fdocuments.us/reader036/viewer/2022062406/55be09e8bb61ebb8588b4636/html5/thumbnails/19.jpg)
•The objective of the addition of polynomial is to perform a symbolic addition of two polynomials.
• p1 :2x^ 6 + x^3+5x+4•P2: 7x^6+8x^5-9x^3+10x^2+14
Be the two polynomials over a variable x.
The objective is to obtain the algebraic sum of p1 and p2 as,
p1+p2=9x^6+8x^5-8x^3+10x^2+5x+18.
![Page 20: linkedlist](https://reader036.fdocuments.us/reader036/viewer/2022062406/55be09e8bb61ebb8588b4636/html5/thumbnails/20.jpg)
0 1 0 0 0 0 0 0 0 0 0 0 2 0 0 1 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
Sparse matrix in multiply linked list:
7x6
![Page 21: linkedlist](https://reader036.fdocuments.us/reader036/viewer/2022062406/55be09e8bb61ebb8588b4636/html5/thumbnails/21.jpg)
7 6 0 1 0 2 0 4 0 6
1 0
3 0
6 0
7 0
1 2 1
3 1 2 3 4 1
6 2 3
7 6 1
START
![Page 22: linkedlist](https://reader036.fdocuments.us/reader036/viewer/2022062406/55be09e8bb61ebb8588b4636/html5/thumbnails/22.jpg)
THANK YOU