Application of Linked Lists | Programming and Data Structures - Computer Science Engineering (CSE) PDF Download

A linked list is a linear data structure, in which the elements are not stored at contiguous memory locations. The elements in a linked list are linked using pointers as shown in the below image:
Application of Linked Lists | Programming and Data Structures - Computer Science Engineering (CSE)

Applications of linked list in computer science

  1. Implementation of stacks and queues
  2. Implementation of graphs: Adjacency list representation of graphs is most popular which is uses linked list to store adjacent vertices.
  3. Dynamic memory allocation: We use linked list of free blocks.
  4. Maintaining directory of names
  5. Performing arithmetic operations on long integers
  6. Manipulation of polynomials by storing constants in the node of linked list
  7. Representing sparse matrices

Applications of linked list in real world

  1. Image viewer: Previous and next images are linked, hence can be accessed by next and previous button.
  2. Previous and next page in web browser: We can access previous and next url searched in web browser by pressing back and next button since, they are linked as linked list.
  3. Music Player: Songs in music player are linked to previous and next song. you can play songs either from starting or ending of the list.

Applications of Circular Linked Lists

  1. Useful for implementation of queue. Unlike this implementation, we don’t need to maintain two pointers for front and rear if we use circular linked list. We can maintain a pointer to the last inserted node and front can always be obtained as next of last.
  2. Circular lists are useful in applications to repeatedly go around the list. For example, when multiple applications are running on a PC, it is common for the operating system to put the running applications on a list and then to cycle through them, giving each of them a slice of time to execute, and then making them wait while the CPU is given to another application. It is convenient for the operating system to use a circular list so that when it reaches the end of the list it can cycle around to the front of the list.
  3. Circular Doubly Linked Lists are used for implementation of advanced data structures like Fibonacci Heap.

An example problem:
Design a data structure that supports following operations efficiently.

  1. getMin: Gets minimum
  2. extractMin: Removes minimum
  3. getMax: Gets maximum
  4. extractMax: Removes maximum
  5. insert: Inserts an item. It may be assumed that the inserted item is always greater than maximum so far. For example, a valid insertion order is 10, 12, 13, 20, 50.

Doubly linked list is the best solution here. We maintain head and tail pointers, since inserted item is always greatest, we insert at tail. Deleting an item from head or tail can be done in O(1) time. So all operations take O(1) time.

The document Application of Linked Lists | Programming and Data Structures - Computer Science Engineering (CSE) is a part of the Computer Science Engineering (CSE) Course Programming and Data Structures.
All you need of Computer Science Engineering (CSE) at this link: Computer Science Engineering (CSE)
119 docs|30 tests

Top Courses for Computer Science Engineering (CSE)

FAQs on Application of Linked Lists - Programming and Data Structures - Computer Science Engineering (CSE)

1. What is a linked list and what are its applications?
Ans. A linked list is a data structure that consists of a sequence of elements, where each element contains a reference (link) to the next element. It is commonly used to implement dynamic data structures like stacks, queues, and graphs.
2. How does a linked list differ from an array?
Ans. A linked list differs from an array in several ways. Firstly, a linked list does not require contiguous memory allocation, whereas an array does. Secondly, insertion and deletion operations are more efficient in a linked list compared to an array. However, random access is slower in a linked list as compared to an array.
3. What are the advantages of using a linked list?
Ans. The advantages of using a linked list include dynamic memory allocation, efficient insertion and deletion operations, and flexibility in size. Linked lists also have a constant time complexity for inserting or deleting elements at the beginning or end.
4. Can linked lists be used to implement a stack or a queue?
Ans. Yes, linked lists can be used to implement both stacks and queues. In a stack, elements are added and removed from the same end, while in a queue, elements are added at one end and removed from the other end. Linked lists provide an efficient way to perform these operations.
5. What is the time complexity for searching an element in a linked list?
Ans. The time complexity for searching an element in a linked list is O(n), where n is the number of elements in the linked list. This is because a linked list does not provide direct access to elements, and each element needs to be traversed sequentially until the desired element is found.
119 docs|30 tests
Download as PDF
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

Extra Questions

,

Application of Linked Lists | Programming and Data Structures - Computer Science Engineering (CSE)

,

Summary

,

MCQs

,

pdf

,

video lectures

,

Application of Linked Lists | Programming and Data Structures - Computer Science Engineering (CSE)

,

Semester Notes

,

study material

,

ppt

,

mock tests for examination

,

Viva Questions

,

practice quizzes

,

Important questions

,

Objective type Questions

,

Free

,

shortcuts and tricks

,

past year papers

,

Sample Paper

,

Previous Year Questions with Solutions

,

Exam

,

Application of Linked Lists | Programming and Data Structures - Computer Science Engineering (CSE)

;