Search this site
Embedded Files
Shaligram Prajapat Ph.D.
  • About Prof
    • Books
  • PI-MCA
  • Projects
    • Academic and Industry Projects
      • Project Topics-2K17
      • April 2012
      • M.Tech. (IT) -Projects@2K17
      • Templates
      • Minor Project
      • Integrated M.Tech. Industry Projects
      • Proposal
    • Synopsis
    • Proposal
    • Samples
    • SIH -Smart India Hackathon
  • Teaching
    • CONM-NAD
    • Data Structures
      • Prerequisite
      • ALGORITHM
      • FUNCTION AND RECURSION
      • ASSINGMENT
      • Stack
      • Queue
      • List
        • Linked Stack
        • Linked Queue
        • Linked Polynomial
        • Linked Sparse Matrix
      • Tree
    • Theory of Computation
      • Overview
      • LO, CO
    • Data Science
      • Data Science - Assignments
      • Data Warehousing and Mining
    • Analysis and Design of Algorithms
    • INFO-SEC
    • SKC-AVK
    • Information System Analysis & Design (SAD )
      • Resources
      • Assignment-21
        • Rubrics
    • Research in Computing
      • Journal-List
      • Conference List
      • Formats
      • Abstract
      • Acknowledgement
      • Areas/Topics
      • Introduction
      • Preliminary Concepts
        • Objective of Research
        • Research Methodology
      • References
      • Research Gap
        • Research methodology
      • Research-Publication
        • Invited Talks
      • results
      • Results/Discussion
      • Title
        • FDP-Workshops
      • Tools and Tips
        • Tips for me-To remember(4 conference)
      • Types of Research
      • Types of Research
      • Publications
      • Research in Computing-MCA-XI semester
        • Template
        • Research-Committee-Member
        • Abstract
        • Research Methodology
    • Computer Graphics-IC-503
    • DigitalElex-2020
      • PPTs Digital Electronics
      • Syllabus of DE
      • Assignments
      • Test/Quiz
    • DCO
    • Discrete Structure
      • Discrete Structure
    • IGNOU
    • Tree Data Strucures
  • SP Research
    • Edited Books
    • Conferences
  • Scholars
  • Events & Activity
    • RC-2020
      • Activity
    • Mentor
  • FDP/Workshops/Short Courses
  • Miscellaneous
    • Invited Talk /Expert Talk
    • My Students
    • My Teachers
  • Publications
  • Recommendations
    • Books
    • ECC- Research Publications
  • Contact me
Shaligram Prajapat Ph.D.
  • About Prof
    • Books
  • PI-MCA
  • Projects
    • Academic and Industry Projects
      • Project Topics-2K17
      • April 2012
      • M.Tech. (IT) -Projects@2K17
      • Templates
      • Minor Project
      • Integrated M.Tech. Industry Projects
      • Proposal
    • Synopsis
    • Proposal
    • Samples
    • SIH -Smart India Hackathon
  • Teaching
    • CONM-NAD
    • Data Structures
      • Prerequisite
      • ALGORITHM
      • FUNCTION AND RECURSION
      • ASSINGMENT
      • Stack
      • Queue
      • List
        • Linked Stack
        • Linked Queue
        • Linked Polynomial
        • Linked Sparse Matrix
      • Tree
    • Theory of Computation
      • Overview
      • LO, CO
    • Data Science
      • Data Science - Assignments
      • Data Warehousing and Mining
    • Analysis and Design of Algorithms
    • INFO-SEC
    • SKC-AVK
    • Information System Analysis & Design (SAD )
      • Resources
      • Assignment-21
        • Rubrics
    • Research in Computing
      • Journal-List
      • Conference List
      • Formats
      • Abstract
      • Acknowledgement
      • Areas/Topics
      • Introduction
      • Preliminary Concepts
        • Objective of Research
        • Research Methodology
      • References
      • Research Gap
        • Research methodology
      • Research-Publication
        • Invited Talks
      • results
      • Results/Discussion
      • Title
        • FDP-Workshops
      • Tools and Tips
        • Tips for me-To remember(4 conference)
      • Types of Research
      • Types of Research
      • Publications
      • Research in Computing-MCA-XI semester
        • Template
        • Research-Committee-Member
        • Abstract
        • Research Methodology
    • Computer Graphics-IC-503
    • DigitalElex-2020
      • PPTs Digital Electronics
      • Syllabus of DE
      • Assignments
      • Test/Quiz
    • DCO
    • Discrete Structure
      • Discrete Structure
    • IGNOU
    • Tree Data Strucures
  • SP Research
    • Edited Books
    • Conferences
  • Scholars
  • Events & Activity
    • RC-2020
      • Activity
    • Mentor
  • FDP/Workshops/Short Courses
  • Miscellaneous
    • Invited Talk /Expert Talk
    • My Students
    • My Teachers
  • Publications
  • Recommendations
    • Books
    • ECC- Research Publications
  • Contact me
  • More
    • About Prof
      • Books
    • PI-MCA
    • Projects
      • Academic and Industry Projects
        • Project Topics-2K17
        • April 2012
        • M.Tech. (IT) -Projects@2K17
        • Templates
        • Minor Project
        • Integrated M.Tech. Industry Projects
        • Proposal
      • Synopsis
      • Proposal
      • Samples
      • SIH -Smart India Hackathon
    • Teaching
      • CONM-NAD
      • Data Structures
        • Prerequisite
        • ALGORITHM
        • FUNCTION AND RECURSION
        • ASSINGMENT
        • Stack
        • Queue
        • List
          • Linked Stack
          • Linked Queue
          • Linked Polynomial
          • Linked Sparse Matrix
        • Tree
      • Theory of Computation
        • Overview
        • LO, CO
      • Data Science
        • Data Science - Assignments
        • Data Warehousing and Mining
      • Analysis and Design of Algorithms
      • INFO-SEC
      • SKC-AVK
      • Information System Analysis & Design (SAD )
        • Resources
        • Assignment-21
          • Rubrics
      • Research in Computing
        • Journal-List
        • Conference List
        • Formats
        • Abstract
        • Acknowledgement
        • Areas/Topics
        • Introduction
        • Preliminary Concepts
          • Objective of Research
          • Research Methodology
        • References
        • Research Gap
          • Research methodology
        • Research-Publication
          • Invited Talks
        • results
        • Results/Discussion
        • Title
          • FDP-Workshops
        • Tools and Tips
          • Tips for me-To remember(4 conference)
        • Types of Research
        • Types of Research
        • Publications
        • Research in Computing-MCA-XI semester
          • Template
          • Research-Committee-Member
          • Abstract
          • Research Methodology
      • Computer Graphics-IC-503
      • DigitalElex-2020
        • PPTs Digital Electronics
        • Syllabus of DE
        • Assignments
        • Test/Quiz
      • DCO
      • Discrete Structure
        • Discrete Structure
      • IGNOU
      • Tree Data Strucures
    • SP Research
      • Edited Books
      • Conferences
    • Scholars
    • Events & Activity
      • RC-2020
        • Activity
      • Mentor
    • FDP/Workshops/Short Courses
    • Miscellaneous
      • Invited Talk /Expert Talk
      • My Students
      • My Teachers
    • Publications
    • Recommendations
      • Books
      • ECC- Research Publications
    • Contact me

List

List 

A list can be defined as a finite collection of data elements. The elements that constitute the list are known as list items. In general, a list can be defined as 

L={a1,a2,a3,....,an }

Where a1,a2,a3,....,an = ai  are list items

A list is a very common data structure that has a wide variety of applications.

For implementation, we can assume that the list items belong to the same type of items (homogeneous nature) or of the same data types.

A list can be treated as a finite collection of homogeneous data items. Such a list can be implemented using arrays.

Operations:

The common operations that can be characterised for list data items are as follows:

  1. Checking for an empty list

  2. Checking for a full list

  3. Inserting a new element

  4. Deleting an element

  5. Searching for a particular element

  6. Finding the length of a list

  7. Merging list

  8. Concatenation of a list

  9. List traversal

  10. Displaying a list

Need for Dynamic Implementation of List

When a List is implemented using an Array, the problem of overflow is always associated with it. This is because an array is a finite structure. Its size must be declared in advance.

For example, if an array is declared with size 10, it can store only 10 elements. When all the 10 slots are occupied and we try to insert a new element, an overflow condition occurs. This can happen even when free memory is available in the computer system.

One solution is to declare an array with a large size. This can postpone the overflow problem. However, it may result in memory wastage because the memory allocated to the array remains reserved for that array and cannot be easily used for another purpose.

Therefore, we need an implementation in which:

  1. The maximum size of the List is not fixed in advance.

  2. A new element can be inserted whenever free memory is available.

  3. When an element is deleted, the memory occupied by it should be released.

  4. The released memory should be returned to the computer system so that it can be used for other purposes.

This is possible through dynamic memory allocation.

In the C language, dynamic memory allocation is performed using pointers and functions such as:

  • malloc() — allocates memory dynamically.

  • free() — releases dynamically allocated memory.

Thus, a linked list is commonly used to implement a List dynamically because it can grow and shrink according to the available memory.

Linked List

A linked list can be defined as a collection of nodes where each node consists of two parts:

  1. Info Part or Data Part

  2. Next Part or Pointer Part or Next Address Part

In a linked list, the physical and logical ordering of nodes need not be the same.

For example, nodes may be stored at different memory locations, but the Next pointer connects them in the required logical sequence.

Operations on a Linked List

  1. Declaration of a linked-list node.

  2. Initialization of the linked list.

  3. Checking whether the list is empty.

  4. Insertion of a node into the linked list.

  5. Deletion of a node from the linked list.

  6. Searching for an item in the linked list.

  7. Traversing the linked list.

  8. Concatenation of two linked lists.

  9. Merging two linked lists.

  10. Counting the number of nodes in the linked list.

  11. Insertion at different positions:

    • At the beginning

    • At the end

    • Before a selected node

    • After a selected node

    • At a specified position

  12. Deletion from different positions:

    • From the beginning

    • From the end

    • From anywhere in the list

  13. Updating the information stored in a node.

Advantages of a Linked List over an Array-Based List


1. No Fixed Size

A linked list does not require a fixed size to be declared in advance.

Memory is allocated dynamically as new nodes are required.

2. Easy Insertion

A new node can be inserted by changing the required links.

Existing nodes do not need to be shifted, as they are in an array.

3. Easy Deletion

A node can be deleted by changing the links between the surrounding nodes.

Other nodes do not need to be shifted.

4. Better Memory Utilisation

Memory is allocated when a node is required.

Therefore, unused pre-allocated array space can be avoided.

However, each node requires additional memory for storing the pointer.

5. Dynamic Structure

The size of a linked list can grow or shrink during program execution, subject to the availability of memory.

6. Useful for Implementing Other Data Structures

Linked lists can be used to implement several other data structures, such as:

  1. Linked Stack

  2. Linked Queue

  3. Sparse Matrix

  4. Polynomial Representation

Important Note about Overflow

It is not technically correct to say: "A linked list has no overflow problem."

A linked list can also become full when the system is unable to allocate additional memory. A more accurate statement is:

"A linked list does not have the fixed-size overflow problem associated with a statically allocated array."


Thus, an array may report overflow when its allocated capacity is exhausted, even if additional memory is available elsewhere in the system. A linked list can dynamically request memory for new nodes, provided sufficient memory is available.


Algorithm: Insertion in Between a Linked List


Purpose: Insert a new node after the node containing the value val.

Algorithm:

  1. ptr = list

  2. While (ptr != NULL), repeat Steps 3 to 5.

  3. If (Info(ptr) == val), then:

    1. x = new node

    2. Read(Info(x))

    3. Next(x) = Next(ptr)

    4. Next(ptr) = x

    5. Exit (if only one insertion is required)

  4. ptr = Next(ptr)

  5. End While

  6. End of Algorithm


The two important statements are:

Next(x)   = Next(ptr)

Next(ptr) = x

This first connects the new node X to the next node, and then connects ptr to X.

Important: If the algorithm is intended to insert only one node, use Exit after insertion. Otherwise, the traversal may continue and potentially perform additional insertions.


Algorithm: Insertion of a Data Item Before a Selected Node

Purpose: Insert a new node before the node containing the selected value val in a singly linked list.


Algorithm:

  1. ptr = list

  2. prev = NULL

  3. While (ptr != NULL), repeat Steps 4 to 7.

  4. If (Info(ptr) == val), then:

x = new node

Read(Info(x))

Next(x) = ptr

If (prev == NULL), then:

list = x

Otherwise:

Next(prev) = x

Exit

  1. prev = ptr

  2. ptr = Next(ptr)

  3. End While

  4. End of Algorithm



Algorithm: Deletion of a Node from a Linked List

Purpose: Delete the node containing a selected value val from a singly linked list.

Algorithm:

  1. ptr = list

  2. prev = NULL

  3. If (list == NULL), then

Print "Underflow / List is Empty"

Go to Step 9

  1. While (ptr != NULL), repeat Steps 5 to 7.

  2. If (Info(ptr) == val), then:

If (prev == NULL), then
list = Next(ptr)

Otherwise,
Next(prev) = Next(ptr)

Free(ptr)

Exit

  1. prev = ptr

  2. ptr = Next(ptr)

  3. End While

  4. Print "Node not found"

  5. End of Algorithm

Useful Links :  Research Gate |Linked In | Google Scholar |Web of Science|  ORCID |Scopus ID|Google Site | Vidwan-ID  

Google Sites
Report abuse
Page details
Page updated
Google Sites
Report abuse