Linked Lists: Introduction Linked lists
Representation of linked list
operations on linked list
Comparison of Linked Lists with Arrays and Dynamic Arrays
Types of Linked Lists and operations-Circular Single Linked List, Double Linked List, Circular Double Linked List
What is Link list? explained with animationsPratikNaik41
This Presentation expalins what are data structures and linked lists with animations.
It also contains a sample implementation of Linked List using C++language.
It uses C++ Pointers to define linked lists.
DATA STRUCUTRES AND LINKED LIST
WHAT ARE DATA STRUCTURES?
Classification Of Data Structures ?
WHAT IS LINKED LIST?
WHY USE LINKED LIST?
INSERTION AND DELETION IN LINKED LIST
LINKED LIST CODE
The document discusses data structures and linked lists. It begins with an introduction to data structures, classifying them as primitive, non-primitive, linear and non-linear. Linked lists are introduced as a linear data structure where elements are linked using pointers rather than stored contiguously in memory. Key advantages of linked lists over arrays are their dynamic size and ease of insertion/deletion. The document provides examples of creating nodes for a linked list in memory and connecting them using pointers.
This is a presentation on Linked Lists, one of the most important topics on Data Structures and algorithms. Anyone who is new to DSA or wants to have a theoretical understanding of the same can refer to it :D
This document discusses various operations that can be performed on one-way linked lists including traversing, searching, inserting, deleting, copying, merging, and splitting linked lists. It provides algorithms and explanations for each operation using diagrams and pseudocode. Key points covered include inserting and deleting nodes from the beginning, end, or a particular position of a linked list, as well as merging two sorted linked lists into a single sorted list.
The document discusses different types of linked lists including:
- Singly linked lists that can only be traversed in one direction.
- Doubly linked lists that allow traversal in both directions using forward and backward pointers.
- Circular linked lists where the last node points back to the first node allowing continuous traversal.
- Header linked lists that include a header node at the beginning for simplified insertion and deletion. Header lists can be grounded where the last node contains a null pointer or circular where the last node points to the header.
- Two-way or doubly linked lists where each node contains a forward and backward pointer allowing bidirectional traversal through the list.
In computer science, a linked list is a linear collection of data elements, whose order is not given by their physical placement in memory. Instead, each element points to the next. It is a data structure consisting of a collection of nodes which together represent a sequence.
The document discusses different types of linked lists including singly linked lists, doubly linked lists, and circularly linked lists. Singly linked lists contain nodes that point to the next node in the list, while doubly linked lists contain nodes that point to both the next and previous nodes. Circularly linked lists form a circle with the last node pointing back to the first node. The document provides code examples for common linked list operations like insertion, removal and traversal for each of the linked list types.
Linked Lists: Introduction Linked lists
Representation of linked list
operations on linked list
Comparison of Linked Lists with Arrays and Dynamic Arrays
Types of Linked Lists and operations-Circular Single Linked List, Double Linked List, Circular Double Linked List
What is Link list? explained with animationsPratikNaik41
This Presentation expalins what are data structures and linked lists with animations.
It also contains a sample implementation of Linked List using C++language.
It uses C++ Pointers to define linked lists.
DATA STRUCUTRES AND LINKED LIST
WHAT ARE DATA STRUCTURES?
Classification Of Data Structures ?
WHAT IS LINKED LIST?
WHY USE LINKED LIST?
INSERTION AND DELETION IN LINKED LIST
LINKED LIST CODE
The document discusses data structures and linked lists. It begins with an introduction to data structures, classifying them as primitive, non-primitive, linear and non-linear. Linked lists are introduced as a linear data structure where elements are linked using pointers rather than stored contiguously in memory. Key advantages of linked lists over arrays are their dynamic size and ease of insertion/deletion. The document provides examples of creating nodes for a linked list in memory and connecting them using pointers.
This is a presentation on Linked Lists, one of the most important topics on Data Structures and algorithms. Anyone who is new to DSA or wants to have a theoretical understanding of the same can refer to it :D
This document discusses various operations that can be performed on one-way linked lists including traversing, searching, inserting, deleting, copying, merging, and splitting linked lists. It provides algorithms and explanations for each operation using diagrams and pseudocode. Key points covered include inserting and deleting nodes from the beginning, end, or a particular position of a linked list, as well as merging two sorted linked lists into a single sorted list.
The document discusses different types of linked lists including:
- Singly linked lists that can only be traversed in one direction.
- Doubly linked lists that allow traversal in both directions using forward and backward pointers.
- Circular linked lists where the last node points back to the first node allowing continuous traversal.
- Header linked lists that include a header node at the beginning for simplified insertion and deletion. Header lists can be grounded where the last node contains a null pointer or circular where the last node points to the header.
- Two-way or doubly linked lists where each node contains a forward and backward pointer allowing bidirectional traversal through the list.
In computer science, a linked list is a linear collection of data elements, whose order is not given by their physical placement in memory. Instead, each element points to the next. It is a data structure consisting of a collection of nodes which together represent a sequence.
The document discusses different types of linked lists including singly linked lists, doubly linked lists, and circularly linked lists. Singly linked lists contain nodes that point to the next node in the list, while doubly linked lists contain nodes that point to both the next and previous nodes. Circularly linked lists form a circle with the last node pointing back to the first node. The document provides code examples for common linked list operations like insertion, removal and traversal for each of the linked list types.
a. Concept and Definition✓
b. Inserting and Deleting nodes ✓
c. Linked implementation of a stack (PUSH/POP) ✓
d. Linked implementation of a queue (Insert/Remove) ✓
e. Circular List
• Stack as a circular list (PUSH/POP) ✓
• Queue as a circular list (Insert/Remove) ✓
f. Doubly Linked List (Insert/Remove) ✓
For more course related material:
https://github.com/ashim888/dataStructureAndAlgorithm/
Personal blog
www.ashimlamichhane.com.np
Insertion in a singly linked list can be done at the beginning, middle, or end of the list. To insert a node, a new node is first created and its data and link fields are initialized. For insertion at the beginning, the new node's link is set to the current head node and the head is updated to the new node. For middle insertion, the link of the new node is set to the link of the previous node and the previous node's link is updated to the new node. For end insertion, the link of the last existing node is updated to the new node and the new node's link is set to null. Traversal may be needed to reach the insertion point, with conditions to stop at
This document discusses data structures and linked lists. It provides definitions and examples of different types of linked lists, including:
- Single linked lists, which contain nodes with a data field and a link to the next node.
- Circular linked lists, where the last node links back to the first node, forming a loop.
- Doubly linked lists, where each node contains links to both the previous and next nodes.
- Operations on linked lists such as insertion, deletion, traversal, and searching are also described.
Deletion from single way linked list and searchEstiak Khan
The document discusses linked lists and operations on single linked lists such as deletion and searching. It defines a linked list as a linear data structure containing nodes with a data and link part, where the link part contains the address of the next node. It describes how to delete nodes from different positions in a single linked list, including the first, last, and intermediate nodes. It also explains how to perform a linear search to find a required element by traversing the list node by node.
1) Linked lists are a data structure that store elements in individual nodes that are connected to each other using pointers. This allows for dynamic memory allocation as opposed to static allocation in arrays.
2) The basic operations on linked lists include creation, insertion, deletion, traversal, searching, concatenation, and displaying the list. Insertion and deletion can be done at the beginning, middle, or end of the list.
3) Linked lists are useful for applications that require dynamic memory allocation, like stacks, queues, and storing objects that may vary in number, such as images to burn to a CD.
This document provides an overview of linked lists as a data structure. It discusses the components of linked list nodes that contain data and a pointer to the next node. It also describes different types of linked lists like singly linked, doubly linked, and circular linked lists. Key operations like insertion, retrieval, and deletion of nodes are demonstrated with code examples. The advantages of linked lists like dynamic size and efficient insertions/deletions are contrasted with arrays.
This document provides an overview of basic concepts related to data structures and algorithms. It discusses key topics such as the definition of a data structure as an organization of data and how it relates to algorithms. The document also covers classifications of data structures into primitive and non-primitive types as well as linear and non-linear structures. Specific data structures like arrays, stacks, queues, linked lists, trees and graphs are introduced. It provides examples of contiguous structures like arrays and structures, as well as non-contiguous structures like linked lists.
This document provides an introduction to data structures and discusses various concepts related to data structures including:
1) Classifications of data structures as primitive and non-primitive, linear and non-linear.
2) Common operations on data structures like traversing, searching, inserting, deleting etc.
3) Pointers and dynamic memory allocation in C using functions like malloc(), calloc(), realloc() and free().
Linked lists allow for dynamic memory allocation by connecting nodes using pointers. There are several types of linked lists including singly linked, doubly linked, and circular linked lists. Singly linked lists use a single pointer to connect nodes in a linear fashion, while doubly linked lists use two pointers to allow traversal in both directions. Circular linked lists connect the last node back to the first to form a circular structure. Common operations on linked lists include insertion, deletion, traversal, and searching which are implemented through manipulating the pointers between nodes.
This document discusses different types of data structures, with a focus on linked lists. It defines a linked list as a linear data structure containing nodes where each node has a data element and a link to the next node. The document outlines the basic operations that can be performed on linked lists, including creation, insertion, deletion, traversal, searching, concatenation, and display. It also discusses different types of linked lists like single linked lists, double linked lists, circular linked lists, and circular double linked lists.
This document discusses different types of linked lists, including singly-linked lists where each node has a link to the next node, doubly-linked lists where each node has links to both the next and previous nodes, and circularly-linked lists where the first and last nodes are linked together. It also describes the basic node structure that makes up a linked list, with a data field and link to another node.
The document provides information about the Data Structures course offered by S. Durga Devi from CSE department of CBIT. It includes the course objectives, outcomes, units and topics covered in the course. The 5 units cover introduction to data structures, linked lists, stacks and queues, trees, hashing and balanced search trees. Commonly used data structures like arrays, linked lists, stacks, queues, trees and graphs are part of the course. Sorting algorithms like quicksort and mergesort are also included. The performance of algorithms is analyzed in terms of time and space complexity. Asymptotic notations like Big-O, Omega and Theta are discussed for analyzing algorithms. Recursion and its applications are explained.
The document discusses various data structures and their operations. It begins by defining a tree as a non-linear data structure used to store hierarchical data. Binary trees are discussed, including their two implementation methods (linear and linked representations). Common tree traversals like inorder, preorder and postorder are defined. Applications of trees include syntax analysis, symbol tables and file systems. Binary search trees and AVL trees are also introduced, with AVL trees ensuring subtrees differ in height by at most one for efficient searching.
This document contains questions related to data structures using Python. It covers topics like arrays, linked lists, stacks, queues, trees and their various operations. Some key points:
- It asks to define concepts like ADT, linear and non-linear data structures. Operations on linked lists, stacks and queues are also included.
- Tree related questions cover binary search trees, expression trees, AVL trees, B-trees and heaps. Operations like insertion, deletion and traversal are discussed.
- Other questions include converting between infix, prefix and postfix notation. Implementing various data structures using arrays and linked lists is also covered.
- Applications of different data structures are explored along with their advantages and
Introduction of Data Structures and Algorithms by GOWRU BHARATH KUMARBHARATH KUMAR
Basic Terminology: Elementary Data Organization:
Data Structures Usage
Data Structures Implementation
CLASSIFICATION OF DATA STRUCTURES
DATA STRUCTURES OPERATIONS
Space-Time Trade-off
Searching Algorithms
Data structures allow for the organization and storage of data. There are linear and non-linear data structures. Linear structures include arrays, stacks, queues, and linked lists. Arrays store elements in contiguous memory locations. Stacks and queues follow first-in last-out and first-in first-out rules respectively. Linked lists connect nodes using pointers. Non-linear structures include trees and graphs which emulate hierarchical and network-like connections. Common operations on data structures include traversing, searching, insertion, and deletion.
1. The document introduces fundamental concepts of data structures including data representation, abstract data types, arrays, structures, pointers, and recursion.
2. Key data representation methods are discussed including integer, real number, character, and string representation. Common data structure types like arrays and structures are also covered.
3. Recursion and algorithms are explained, focusing on time and space complexity analysis using Big-O notation and examples like factorial and Fibonacci sequences.
The document discusses various data structures and their classification. It begins by stating the objectives of understanding how data structures can be classified, basic data types and arrays, and problem-oriented data structures used to solve specific problems. It then defines key terms like data, information, and data structures. It describes primitive and non-primitive, linear and non-linear data structures. It also discusses basic and problem-oriented data structures like lists, stacks, queues, and trees. It provides examples and applications of different data structures.
This document provides an introduction to data structures. It discusses algorithms, data structures, and the classification of common data structures including linear structures like arrays, stacks, queues, and linked lists as well as non-linear structures like trees and graphs. Operations for each data structure are also outlined such as traversal, search, insertion, and deletion. Representations of how each structure stores data in memory are demonstrated.
The document discusses abstract data types (ADTs) and several common data structures, including stacks, queues, linked lists, trees, and their applications. An ADT defines a data type and operations on that data type without specifying how those operations are implemented. Common programming languages define simple ADTs like integers, while more complex ADTs like lists, stacks and queues must be explicitly defined. The key operations and applications of each data structure are described.
a. Concept and Definition✓
b. Inserting and Deleting nodes ✓
c. Linked implementation of a stack (PUSH/POP) ✓
d. Linked implementation of a queue (Insert/Remove) ✓
e. Circular List
• Stack as a circular list (PUSH/POP) ✓
• Queue as a circular list (Insert/Remove) ✓
f. Doubly Linked List (Insert/Remove) ✓
For more course related material:
https://github.com/ashim888/dataStructureAndAlgorithm/
Personal blog
www.ashimlamichhane.com.np
Insertion in a singly linked list can be done at the beginning, middle, or end of the list. To insert a node, a new node is first created and its data and link fields are initialized. For insertion at the beginning, the new node's link is set to the current head node and the head is updated to the new node. For middle insertion, the link of the new node is set to the link of the previous node and the previous node's link is updated to the new node. For end insertion, the link of the last existing node is updated to the new node and the new node's link is set to null. Traversal may be needed to reach the insertion point, with conditions to stop at
This document discusses data structures and linked lists. It provides definitions and examples of different types of linked lists, including:
- Single linked lists, which contain nodes with a data field and a link to the next node.
- Circular linked lists, where the last node links back to the first node, forming a loop.
- Doubly linked lists, where each node contains links to both the previous and next nodes.
- Operations on linked lists such as insertion, deletion, traversal, and searching are also described.
Deletion from single way linked list and searchEstiak Khan
The document discusses linked lists and operations on single linked lists such as deletion and searching. It defines a linked list as a linear data structure containing nodes with a data and link part, where the link part contains the address of the next node. It describes how to delete nodes from different positions in a single linked list, including the first, last, and intermediate nodes. It also explains how to perform a linear search to find a required element by traversing the list node by node.
1) Linked lists are a data structure that store elements in individual nodes that are connected to each other using pointers. This allows for dynamic memory allocation as opposed to static allocation in arrays.
2) The basic operations on linked lists include creation, insertion, deletion, traversal, searching, concatenation, and displaying the list. Insertion and deletion can be done at the beginning, middle, or end of the list.
3) Linked lists are useful for applications that require dynamic memory allocation, like stacks, queues, and storing objects that may vary in number, such as images to burn to a CD.
This document provides an overview of linked lists as a data structure. It discusses the components of linked list nodes that contain data and a pointer to the next node. It also describes different types of linked lists like singly linked, doubly linked, and circular linked lists. Key operations like insertion, retrieval, and deletion of nodes are demonstrated with code examples. The advantages of linked lists like dynamic size and efficient insertions/deletions are contrasted with arrays.
This document provides an overview of basic concepts related to data structures and algorithms. It discusses key topics such as the definition of a data structure as an organization of data and how it relates to algorithms. The document also covers classifications of data structures into primitive and non-primitive types as well as linear and non-linear structures. Specific data structures like arrays, stacks, queues, linked lists, trees and graphs are introduced. It provides examples of contiguous structures like arrays and structures, as well as non-contiguous structures like linked lists.
This document provides an introduction to data structures and discusses various concepts related to data structures including:
1) Classifications of data structures as primitive and non-primitive, linear and non-linear.
2) Common operations on data structures like traversing, searching, inserting, deleting etc.
3) Pointers and dynamic memory allocation in C using functions like malloc(), calloc(), realloc() and free().
Linked lists allow for dynamic memory allocation by connecting nodes using pointers. There are several types of linked lists including singly linked, doubly linked, and circular linked lists. Singly linked lists use a single pointer to connect nodes in a linear fashion, while doubly linked lists use two pointers to allow traversal in both directions. Circular linked lists connect the last node back to the first to form a circular structure. Common operations on linked lists include insertion, deletion, traversal, and searching which are implemented through manipulating the pointers between nodes.
This document discusses different types of data structures, with a focus on linked lists. It defines a linked list as a linear data structure containing nodes where each node has a data element and a link to the next node. The document outlines the basic operations that can be performed on linked lists, including creation, insertion, deletion, traversal, searching, concatenation, and display. It also discusses different types of linked lists like single linked lists, double linked lists, circular linked lists, and circular double linked lists.
This document discusses different types of linked lists, including singly-linked lists where each node has a link to the next node, doubly-linked lists where each node has links to both the next and previous nodes, and circularly-linked lists where the first and last nodes are linked together. It also describes the basic node structure that makes up a linked list, with a data field and link to another node.
The document provides information about the Data Structures course offered by S. Durga Devi from CSE department of CBIT. It includes the course objectives, outcomes, units and topics covered in the course. The 5 units cover introduction to data structures, linked lists, stacks and queues, trees, hashing and balanced search trees. Commonly used data structures like arrays, linked lists, stacks, queues, trees and graphs are part of the course. Sorting algorithms like quicksort and mergesort are also included. The performance of algorithms is analyzed in terms of time and space complexity. Asymptotic notations like Big-O, Omega and Theta are discussed for analyzing algorithms. Recursion and its applications are explained.
The document discusses various data structures and their operations. It begins by defining a tree as a non-linear data structure used to store hierarchical data. Binary trees are discussed, including their two implementation methods (linear and linked representations). Common tree traversals like inorder, preorder and postorder are defined. Applications of trees include syntax analysis, symbol tables and file systems. Binary search trees and AVL trees are also introduced, with AVL trees ensuring subtrees differ in height by at most one for efficient searching.
This document contains questions related to data structures using Python. It covers topics like arrays, linked lists, stacks, queues, trees and their various operations. Some key points:
- It asks to define concepts like ADT, linear and non-linear data structures. Operations on linked lists, stacks and queues are also included.
- Tree related questions cover binary search trees, expression trees, AVL trees, B-trees and heaps. Operations like insertion, deletion and traversal are discussed.
- Other questions include converting between infix, prefix and postfix notation. Implementing various data structures using arrays and linked lists is also covered.
- Applications of different data structures are explored along with their advantages and
Introduction of Data Structures and Algorithms by GOWRU BHARATH KUMARBHARATH KUMAR
Basic Terminology: Elementary Data Organization:
Data Structures Usage
Data Structures Implementation
CLASSIFICATION OF DATA STRUCTURES
DATA STRUCTURES OPERATIONS
Space-Time Trade-off
Searching Algorithms
Data structures allow for the organization and storage of data. There are linear and non-linear data structures. Linear structures include arrays, stacks, queues, and linked lists. Arrays store elements in contiguous memory locations. Stacks and queues follow first-in last-out and first-in first-out rules respectively. Linked lists connect nodes using pointers. Non-linear structures include trees and graphs which emulate hierarchical and network-like connections. Common operations on data structures include traversing, searching, insertion, and deletion.
1. The document introduces fundamental concepts of data structures including data representation, abstract data types, arrays, structures, pointers, and recursion.
2. Key data representation methods are discussed including integer, real number, character, and string representation. Common data structure types like arrays and structures are also covered.
3. Recursion and algorithms are explained, focusing on time and space complexity analysis using Big-O notation and examples like factorial and Fibonacci sequences.
The document discusses various data structures and their classification. It begins by stating the objectives of understanding how data structures can be classified, basic data types and arrays, and problem-oriented data structures used to solve specific problems. It then defines key terms like data, information, and data structures. It describes primitive and non-primitive, linear and non-linear data structures. It also discusses basic and problem-oriented data structures like lists, stacks, queues, and trees. It provides examples and applications of different data structures.
This document provides an introduction to data structures. It discusses algorithms, data structures, and the classification of common data structures including linear structures like arrays, stacks, queues, and linked lists as well as non-linear structures like trees and graphs. Operations for each data structure are also outlined such as traversal, search, insertion, and deletion. Representations of how each structure stores data in memory are demonstrated.
The document discusses abstract data types (ADTs) and several common data structures, including stacks, queues, linked lists, trees, and their applications. An ADT defines a data type and operations on that data type without specifying how those operations are implemented. Common programming languages define simple ADTs like integers, while more complex ADTs like lists, stacks and queues must be explicitly defined. The key operations and applications of each data structure are described.
1. Chapter – 2 The Linked List
Asmelash Girmay
Department of Information Technology
Data Structures
2. 2.1 Introduction
• If a memory is allocated for a variable during the compilation (i.e. before
execution) of a program, then it is fixed and cannot be changed.
• For Example: an array A[20] is declared with 20 elements, then the allocated
memory is fixed and cannot decrease or increase SIZE of the array if required.
• So we have to adopt an alternative strategy to allocate memory only when it is
required.
• There is a special data structure called linked list that provides a more flexible
storage system and it does not require the use of arrays.
IT3201 Data Structures 2
2018-10-30
3. 2.2 Definition of Linked List
• A linked list is a linear collection of specially designed data elements, called nodes, linked to one
another by means of pointers.
• Each node is divided into two parts: the first part contains the information of the element, and
the second part contains the address part of the next node in the linked list.
• Address part of the node is also called linked or next field.
• Note:
• The arrow is drown from the address part to the next node.
• The next pointer of the last node contains a special value, called the NULL pointer, which does not point to
any address of the node.
• i.e. NULL pointer indicates the end of the linked list.
• START pointer will hold the address of the first node in the list START=NULL if there is no list (i.e. NULL list or
empty list).
IT3201 Data Structures 3
2018-10-30
5. 2.3 Representation of Linked List
• Suppose we want to store a list of integer numbers using linked list. Then it can
be schematically represented as:
• The linear linked list can be represented in memory with the following declaration.
IT3201 Data Structures 5
2018-10-30
6. 2.4 Advantages and Disadvantages
• Advantages:
1. Are dynamic data structure: i.e., they can grow or shrink during the execution of the program.
2. Efficient memory utilization: In linked list (or dynamic) representation, memory is not pre-allocated.
• Memory is allocated whenever it is required. And it is deallocated (or removed) when it is not needed.
3. Insertion and deletion are easier and efficient. Linked list provides flexibility in inserting a data item
at a specified position and deletion of a data item from the given position.
4. Many complex applications can be easily carried out with linked list.
• Disadvantages:
1. More memory: to store an integer number, a node with integer data and address field is allocated.
That is more memory space is needed.
2. Access to an arbitrary data item is little bit cumbersome and also time consuming.
IT3201 Data Structures 6
2018-10-30
7. 2.5 Operations on Linked List
• The primitive operations performed on the linked list are as follows
1. Creation
2. Insertion
3. Deletion
4. Traversing
5. Searching
6. Concatenation
1) Creation operation is used to create a linked list.
• Once a linked list is created with one node, insertion operation can be used to
add more elements in a node.
IT3201 Data Structures 7
2018-10-30
8. 2.5 Operations on Linked List …
2) Insertion operation is used to insert a new node at any specified
location in the linked list. A new node may be inserted.
(a) At the beginning of the linked list
(b) At the end of the linked list
(c) At any specified position in between in a linked list
3) Deletion operation is used to delete an item (or node) from the
linked list. A node may be deleted from the
(a) Beginning of a linked list
(b) End of a linked list
(c) Specified location of the linked list
IT3201 Data Structures 8
2018-10-30
9. 2.5 Operations on Linked List …
4) Traversing is the process of going through all the nodes from one end to
another end of a linked list.
• In a singly linked list we can visit from left to right, forward traversing, nodes only.
• But in doubly linked list forward and backward traversing is possible.
5) Concatenation is the process of appending the second list to the end of
the first list.
• Consider a list A having n nodes and B with m nodes.
• Then the operation concatenation will place the 1st node of B in the (n+1)th node in
A.
• After concatenation A will contain (n+m) nodes
IT3201 Data Structures 9
2018-10-30
10. 2.6 Type of Linked List
• Basically we can divide the linked list into the following three types in
the order in which they (or node) are arranged.
1. Singly linked list
2. Doubly linked list
3. Circular linked list
IT3201 Data Structures 10
2018-10-30
11. 2.6.1 Singly Linked List [SLL]
• All the nodes in a singly linked list are arranged sequentially linked by a pointer.
• A singly linked list can grow or shrink, because it is a dynamic data structure.
IT3201 Data Structures 11
2018-10-30
13. 2.6.1 Singly Linked List…
• Algorithm for Inserting a Node
• Insertion of New Node Suppose START is the first position in linked list.
• Let DATA be the element to be inserted in the new node.
• POS is the position where the new node is to be inserted.
• TEMP is a temporary pointer to hold the node address.
IT3201 Data Structures 13
2018-10-30
14. 2.6.1 Singly Linked List…
• Algorithm for Inserting a Node…
IT3201 Data Structures 14
2018-10-30
15. 2.6.1 Singly Linked List…
• Algorithm for Inserting a Node…
IT3201 Data Structures 15
2018-10-30
Insert a Node at the end
1. Input DATA to be inserted
2. Create a NewNode
3. NewNode → DATA = DATA
4. NewNode → Next = NULL
5. If (SATRT equal to NULL)
(a) START = NewNode
6. Else
(a) TEMP = START
(b) While (TEMP → Next not equal to NULL)
(i) TEMP = TEMP → Next
7. TEMP → Next = NewNode
8. Exit
16. 2.6.1 Singly Linked List…
• Algorithm for Inserting a Node…
IT3201 Data Structures 16
2018-10-30
17. 2.6.1 Singly Linked List…
• Algorithm for Deleting a Node
IT3201 Data Structures 17
2018-10-30
18. 2.6.1 Singly Linked List…
• Algorithm for Deleting a Node…
• Suppose START is the first position in linked list.
Let DATA be the element to be deleted.
TEMP, HOLD is a temporary pointer to hold the
node address.
IT3201 Data Structures 18
2018-10-30
19. 2.6.1 Singly Linked List…
• Algorithm for searching a Node
• Suppose START is the address of the first node in the linked list and DATA is the information to be
searched. After searching, if the DATA is found, POS will contain the corresponding position in the
list.
IT3201 Data Structures 19
2018-10-30
20. 2.6.1 Singly Linked List…
• Algorithm for Traversing the Linked List
• Suppose START is the address of the first node in the linked list.
• Following algorithm will visit all nodes from the START node to the end.
IT3201 Data Structures 20
2018-10-30
Implementation of Singly linked list – LAB#2
21. 2.6.1 Applications SLL
• Singly linked list is used in:
• Implementation of dynamic Stacks
• Implementation of dynamic Queue
• Representation of polynomial functions
IT3201 Data Structures 21
2018-10-30
22. 2.6.1 Applications SLL: Polynomial
• Different operations, such as addition, subtraction, division and multiplication of polynomials can
be performed using linked list.
• In this section, we discuss about polynomial addition using linked list.
• Consider two polynomials f(x) and g(x); it can be represented using linked list as follows in Fig.
IT3201 Data Structures 22
2018-10-30
23. 2.6.2 Doubly Linked List [DLL]
• A doubly linked list is one in which all nodes are linked together by
multiple links which help in accessing both the successor (next) and
predecessor (previous) node for any arbitrary node within the list.
• Every nodes in the doubly linked list has three fields:
• Left Pointer, Right Pointer and DATA. The following fig. shows a typical doubly
linked list.
IT3201 Data Structures 23
2018-10-30
24. 2.6.2 Doubly Linked List…
• LPoint will point to the node in the left side (or previous node) that is LPoint will
hold the address of the previous node.
• RPoint will point to the node in the right side (or next node) that is RPoint will
hold the address of the next node. DATA will store the information of the node.
IT3201 Data Structures 24
2018-10-30
25. 2.6.2 Doubly Linked List Representation
• A node in the doubly linked list can be represented in memory with the following
declarations.
• All the operations performed on singly linked list can also be performed on doubly linked
list. See the ff. insertion and deletion of nodes.
IT3201 Data Structures 25
2018-10-30
26. 2.6.2 Doubly Linked List Representation…
IT3201 Data Structures 26
2018-10-30
Implementation of Doubly linked list – LAB#3
27. 2.6.2 Doubly Linked List Algorithms
• Algorithm for Inserting a Node
• Suppose START is the first position in linked list.
• Let DATA be the element to be inserted in the new node.
• POS is the position where the NewNode is to be inserted.
• TEMP is a temporary pointer to hold the node address.
IT3201 Data Structures 27
2018-10-30
28. 2.6.2 Doubly Linked List Algorithms…
• Algorithm for Inserting a Node…
IT3201 Data Structures 28
2018-10-30
29. 2.6.2 Doubly Linked List Algorithms…
• Algorithm for Deleting a Node
• Suppose START is the address of the first node in the linked list.
• Let POS is the position of the node to be deleted.
• TEMP is the temporary pointer to hold the address of the node.
• After deletion, DATA will contain the information on the deleted node.
IT3201 Data Structures 29
2018-10-30
30. 2.6.2 Doubly Linked List Algorithms…
• Algorithm for Deleting a Node…
IT3201 Data Structures 30
2018-10-30
31. 2.6.3 Circular Linked List [CLL]
• A circular linked list is one, which has no beginning and no end.
• A singly linked list can be made a circular linked list by simply storing the address
of the very first node in the linked field of the last node.
IT3201 Data Structures 31
2018-10-30
Implementation of Circular linked list – LAB#4
32. 2.6.3 Circular Linked List …
• A circular doubly linked list has both the successor pointer and
predecessor pointer in circular manner as shown below.
IT3201 Data Structures 32
2018-10-30
Implementation of Circular linked list – LAB ASSIGN.