ADS Linked List Slides
ADS Linked List Slides
ADS Linked List Slides
➢ Double-linked list:
In a doubly linked list, each node contains references to both the next and previous nodes. This allows
for traversal in both forward and backward directions, but it requires additional memory for the
backward reference.
This is commonly used in computer graphics, scientific computing, and machine learning applications
where large, sparse datasets are handled.
Applications: Used in databases for efficient indexing, in memory allocation systems for quick block
management, and in distributed networks for fast data routing and lookup.
Data Structures: Linked List
Simple linked list Code:
Data Structures: Linked List
Q: Write a python-style pseudocode for Traversing a linked list iteratively, where the pointer head has the
address of the first node of the list?
Data Structures: Linked List
Q: Write a Python-style pseudocode for Traversing a linked list recursively, where the pointer head has the
address of the first node of the list?
Data Structures: Linked List
Q: Write a Python-style pseudocode for searching a key in a linked list recursively, where the pointer head
has the address of the first node of the list?
Data Structures: Linked List
Q: Write a Python-style pseudocode for inserting a node with a key at the start of a linked list?
Data Structures: Linked List
Q: Write a Python-style pseudocode for inserting a node with a key after a location in a linked list?
Data Structures: Linked List
Q: Write a Python-style pseudocode for deleting a node from the starting of a link-list?
Data Structures: Linked List
Q: Write a Python-style pseudocode for deleting a node after a given location from the starting of a linked
list?
Data Structures: Linked List
Q: Write a Python-style pseudocode for reversing a linked list iteratively?
Data Structures: Linked List
Q: The following python function takes a single-linked list of integers as a parameter and rearranges the
elements of the list. The function is called with the list containing the integers 1, 2, 3, 4, 5, 6, 7 in the given
order. What will be the contents of the list after the function completes execution?
solve
Data Structures: Linked List ***(Questions)***
➢ What are the advantages of circular doubly linked list over a single circular linked list? Write an algorithm to
convert a sorted doubly linked list to a balanced binary search tree.
➢ Write an algorithm to perform insertion sort using a linked list.
➢ Write an algorithm that takes two linked lists, sorted in increasing order and merge the two into one linked
list which is in decreasing order, and return it.
➢ Write an algorithm to concatenate two singly linked lists L1 and L2. L1 and L2 are pointers to the first node
of linked lists respectively. After concatenation, L1 points to the first node of the final linked list.
➢ Write an algorithm to analyze the two single linked lists L1, L2, and form a new list L3, which contains the
elements that are common in both L1 and L2 lists.
➢ Write a C program to swap Kth node from the beginning with Kth node from the end in a singly linked list
➢ Write an algorithm to perform Union and Intersection on two sorted linked lists
➢ Write a C program to add a node with data “X” before a node with data “Y” in a singly linked list
➢ Explain the operations of inserting a new node at the front, middle, and rear end of a doubly linked list.
➢ Write an algorithm to print a singly linked list in reverse order
➢ Consider a singly linked list and a data element X. Write a function to find the nth element from the end of
the list.