Linked Lists Dr N SATHEESH CS 215 Outline
- Slides: 42
Linked Lists Dr. N. SATHEESH CS 215
Outline • • • Introduction Insertion Description Deletion Description Basic Node Implementation Conclusion
Outline • • • Introduction Insertion Description Deletion Description Basic Node Implementation Conclusion
Introduction • Definitions – Lists and arrays – Nodes and pointers – Single Linked Lists – Double Linked Lists – Circular Lists • Advantages
Introduction • Definitions – Lists and arrays – Nodes and pointers – Single Linked Lists – Double Linked Lists – Circular Lists • Advantages
Lists and arrays • Lists:
Lists and arrays • Arrays: {Size of the following array is = 4} Index Value 0 44 1 5 2 96 3 3
Introduction • Definitions – Lists and arrays – Nodes and pointers – Single Linked Lists – Double Linked Lists – Circular Lists • Advantages
Nodes and pointers
Introduction • Definitions – Lists and arrays – Nodes and pointers – Single Linked Lists – Double Linked Lists – Circular Lists • Advantages
Single linked lists
Introduction • Definitions – Lists and arrays – Nodes and pointers – Single Linked Lists – Double Linked Lists – Circular Lists • Advantages
Double Linked Lists
Introduction • Definitions – Lists and arrays – Nodes and pointers – Single Linked Lists – Double Linked Lists – Circular Lists • Advantages
Circular Lists
Introduction • Definitions – Lists and arrays – Nodes and pointers – Single Linked Lists – Double Linked Lists – Circular Lists • Advantages
Advantages The Linked List advantages are collected because of the array disadvantages, array disadvantages are: 1. Array Size 2. Memory allocation 3. Insertion and Deletion
Outline • • • Introduction Insertion Description Deletion Description Basic Node Implementation Conclusion
Insertion Description • Insertion at the top of the list • Insertion at the end of the list • Insertion in the middle of the list
Insertion Description • Insertion at the top of the list • Insertion at the end of the list • Insertion in the middle of the list
Insertion at the top Steps: • Create a Node • Set the node data Values • Connect the pointers
Insertion Description head 48 17 142 // • Follow the previous steps and we get Step 1 Step 2 Step 3 head 93
Insertion Description • Insertion at the top of the list • Insertion at the end of the list • Insertion in the middle of the list
Insertion at the end Steps: • Create a Node • Set the node data Values • Connect the pointers
Insertion Description head 48 17 142 // • Follow the previous steps and we get Step 1 Step 2 Step 3
Insertion Description • Insertion at the top of the list • Insertion at the end of the list • Insertion in the middle of the list
Insertion in the middle Steps: • Create a Node • Set the node data Values • Break pointer connection • Re-connect the pointers
Insertion Description Step 1 Step 3 Step 4 Step 2
Outline • • • Introduction Insertion Description Deletion Description Basic Node Implementation Conclusion
Deletion Description • Deleting from the top of the list • Deleting from the end of the list • Deleting from the middle of the list
Deletion Description • Deleting from the top of the list • Deleting from the end of the list • Deleting from the middle of the list
Deleting from the top Steps • Break the pointer connection • Re-connect the nodes • Delete the node
Deletion Description head 6 4 17 42 head
Deletion Description • Deleting from the top of the list • Deleting from the end of the list • Deleting from the middle of the list
Deleting from the end Steps • Break the pointer connection • Set previous node pointer to NULL • Delete the node
Deletion Description head 6 head 4 17 6 4 17 head 42 42
Deletion Description • Deleting from the top of the list • Deleting from the end of the list • Deleting from the middle of the list
Deleting from the Middle Steps • Set previous Node pointer to next node • Break Node pointer connection • Delete the node
Deletion Description head 4 17 42 head 4 17 head 4 42 42
Outline • • • Introduction Insertion Description Deletion Description Basic Node Implementation Conclusion
Basic Node Implementation The following code is written in C++: Struct Node { int data; Node *next; }; //any type of data could be another struct //this is an important piece of code “pointer”
Outline • • • Introduction Insertion Description Deletion Description Basic Node Implementation Conclusion
- Singly linked list vs doubly linked list
- Singly vs doubly linked list
- Pengertian single linked list
- Geometry tangent ratio
- Economic 215
- Health partners plans provider portal
- The formula c=5p+215 relates c
- Sentenza corte costituzionale 215/87
- Economic 215
- Stc 215/1994
- Computer arithmetic
- Work physics
- Completed ics 215 form
- Tc 215
- Eecs 427 umich
- Dtu-215
- Http 148 215 servsoc inicio
- Round 364 to the nearest ten.
- Ley 40/215
- Sandwich sentence writing
- Prolog
- Java types of lists
- Spelling shed
- Swot analysis customer service example
- Political wish lists
- Wish lists year
- Concatinates
- Wish lists year
- Parallel structure example
- Glwords
- Blockly c
- Swst spelling lists
- Political lists new
- Lists of tuples python
- Word study assessment
- Semi colon vs colon
- "new bookmarking lists 2018"
- Functions list
- Year 8 spelling words
- Qri word lists
- Lisp lists
- Who wrote this
- Lesson 3 lists practice