0% found this document useful (0 votes)
24 views1 page

Data Structure Lab Assignment-2

The assignment focuses on implementing linked lists and performing various operations such as insertion, deletion, and duplicate removal. Students are required to write programs in C/C++/Java/Python to handle basic and advanced tasks, including swapping adjacent nodes and reordering the list. The deadline for submission is August 20, 2025, with a subsequent test on August 27, 2025.

Uploaded by

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

Data Structure Lab Assignment-2

The assignment focuses on implementing linked lists and performing various operations such as insertion, deletion, and duplicate removal. Students are required to write programs in C/C++/Java/Python to handle basic and advanced tasks, including swapping adjacent nodes and reordering the list. The deadline for submission is August 20, 2025, with a subsequent test on August 27, 2025.

Uploaded by

smashawon3578
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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.

You might also like