Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
36 views2 pages

Linked - List Assignment 2

The document outlines a series of tasks related to singly and doubly linked lists, including functions for insertion, deletion, reversal, cycle detection, merging, and more. Each task specifies a particular operation to be implemented, such as finding the middle element or checking for palindromes in singly linked lists, and various operations for doubly linked lists like sorting and converting to a balanced BST. The tasks provide a comprehensive guide for practicing linked list manipulation techniques in programming.

Uploaded by

raheelrajpoot886
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views2 pages

Linked - List Assignment 2

The document outlines a series of tasks related to singly and doubly linked lists, including functions for insertion, deletion, reversal, cycle detection, merging, and more. Each task specifies a particular operation to be implemented, such as finding the middle element or checking for palindromes in singly linked lists, and various operations for doubly linked lists like sorting and converting to a balanced BST. The tasks provide a comprehensive guide for practicing linked list manipulation techniques in programming.

Uploaded by

raheelrajpoot886
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment #2

Singly Linked List Tasks

1. Insertion at Specific Position: Implement a function to insert a node at the kth position
in a singly linked list.
2. Deletion by Value: Write a function to delete a node that contains a given value from the
list.
3. Reverse a Linked List: Implement a function to reverse the singly linked list iteratively.
4. Detect a Cycle: Develop an algorithm using Floyd’s cycle detection method to detect a
loop in a linked list.
5. Merge Two Sorted Lists: Write a function to merge two sorted singly linked lists into a
single sorted list.
6. Find Middle Element: Implement a function to find and return the middle element of a
singly linked list in a single traversal.
7. Remove Duplicates: Write a function that removes duplicate elements from a sorted
singly linked list.
8. Find Nth Node from End: Implement a function to return the Nth node from the end of a
singly linked list in one pass.
9. Check if Palindrome: Develop a function to check if a given singly linked list is a
palindrome.
10. Partition List: Given a value x, reorder a singly linked list so that all nodes less than x
come before nodes greater than or equal to x.

Doubly Linked List Tasks

11. Insert After a Given Node: Write a function to insert a new node after a given node in a
doubly linked list.
12. Delete Tail Node: Implement a function to delete the last node of a doubly linked list.
13. Reverse a Doubly Linked List: Develop an algorithm to reverse a doubly linked list in
place.
14. Sort a Doubly Linked List: Implement an algorithm to sort a doubly linked list using
insertion sort.
15. Convert Doubly Linked List to Balanced BST: Write a function to convert a sorted
doubly linked list into a balanced binary search tree (BST).
16. Rotate by N Positions: Given a doubly linked list, rotate it N places to the right.
17. Find and Delete a Node: Implement a function to search for a node containing a specific
value and delete it from the doubly linked list.
18. Convert DLL to Circular DLL: Write a function to convert a doubly linked list into a
circular doubly linked list.
19. Flatten a Multilevel DLL: Implement a function to flatten a doubly linked list where
each node might have a child pointer pointing to another doubly linked list.
20. Clone a Doubly Linked List with Random Pointers: Write a function to clone a doubly
linked list where each node has an additional random pointer to any node in the list

You might also like