Assignment on ICE2232 Data Structure and Algorithm Lab
Linked List
With this assignment, you will work with linked lists and implement various operations on
them. You will also explore the practical applications of linked lists.
Task 1: Basic Linked List Operations
1. Write a C/C++/Java/Python program to create a singly linked list.
2. Implement functions to insert elements (alphabetic, numeric, alphanumeric, strings) at
the beginning, end, and a specific position in the given list.
3. Create a function to delete an element from the list based on its value.
4. Display the contents of the liked list.
5. Implement a function to find the length of the linked list.
Task 2: Handling elements of a Linked List
1. Given a singly linked list consisting of N nodes. The task is to remove duplicates (nodes
with duplicate values) from the given list (if exits). Noted that, pls don’t arrange the
nodes in a sorted way.
Example-1: Input: Linked List: 2 -> 2-> 4- > 5
Output: Processed LinkedList: 2-> 4- > 5
Example-2: Input: LinkedList: 2 -> 2-> 2- > 2
Output: Processed Linked List: LinkedList: 2
2. Given a Linked list, swap every two adjacent nodes and return its head. You must solve
the problem without modifying the values in the list’s nodes (i.e., only nodes
themselves may be changed.).
Example:
Input: 999 -> 888 -> 777 -> 666 -> 555 -> 444-> 333 -> 222
Output: 888 -> 999 -> 666 -> 777 -> 444 -> 555 -> 222 -> 333
3. Given a singly linked list: A0->A1->…….->An-2 ->An-1, reorder it to:
A0 -> An-1 -> A1 -> An-2 -> A2 -> An-3 ->…………….
Example:
Input: 999 -> 888 -> 777 -> 666 -> 555 -> 444-> 333 -> 222 -> 111
Output: 999 -> 111 -> 888 -> 222 -> 777 -> 333 -> 666 -> 444 -> 555
Students are recommended to complete this assignments on/before 20th August
2025 and prepare to sit for CT-1 which will be held 27th August 2025.