0% found this document useful (0 votes)
51 views

Ds A Assignment No. 1

This document provides instructions for Assignment 1 on linked lists for the course Data Structures and Algorithms. Students are asked to extend the List class by writing two methods - Identi() and alike(). The Identi() method removes successive identical nodes in a linked list so that no two consecutive items are equal. The alike() method doubles the length of the linked list by replacing each node with two consecutive nodes of the same item. Students need to submit their work as a zip folder containing the MakeFile, source code files, and name the folder with their registration number by the due date of October 3, 2019.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views

Ds A Assignment No. 1

This document provides instructions for Assignment 1 on linked lists for the course Data Structures and Algorithms. Students are asked to extend the List class by writing two methods - Identi() and alike(). The Identi() method removes successive identical nodes in a linked list so that no two consecutive items are equal. The alike() method doubles the length of the linked list by replacing each node with two consecutive nodes of the same item. Students need to submit their work as a zip folder containing the MakeFile, source code files, and name the folder with their registration number by the due date of October 3, 2019.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Data Structures and Algorithms (CS2133) Assignment No.

Assignment No. 1: Linked List CLO-1


Subject: Data Structures and Algorithms Due Date: 03-10-2019 Marks: 20
Objective: This homework assignment is designed to give you practice working with linked lists and nested loops.
Instructions:
1- This is an individual assignment. You will submit your work individually through your respective CRs.
2- Write your name and registration number at the start of the assignment.
3- Do not copy and paste any thing from the internet. Your work must be original.
4- Please note that you must do your own work. If any one found copying from another student, no marks will be given
to him/ her.
5- Deadline for this assignment is 03 October, 2019. This deadline will not be extended.
6- No assignment will be accepted through email before and after the due date.
The Problem Statement
Your task is to extend the List class which is given in the example program in the handouts of Lecture No. 03 by writing
one method for removing successive identical items from lists, and one method for adding them. The Identi() method
and alike() method will operate on singly-linked lists.

Here is the detail about these functions.

Identi( )
The Identi() method performs as described below.

Identi () takes the list and, wherever two or more consecutive items are the same, it removes identical nodes so that only
one consecutive copy remains. Hence, no two consecutive items in this list are equal upon completion of the procedure.
After Identi() executes, the list may well be shorter than when Identi() began. No extra items are added to make up for
those removed.

For example, if the input list is [ 11 1 1 2 2 2 0 0 0 0 3 3 3 4 4 ], the output list is [ 1 2 0 3 4 ].

Here is the prototype of the Identi() function that you will use in your code.
List Identi(List list);

alike( )
The alike() method performs as described below.

alike() takes the list and doubles its length by replacing each node with two consecutive nodes referencing the same
item. For example, if the input list is [ 1 5 3 7 2 ], the output list is [ 1 1 5 5 3 3 7 7 2 2 ].
Here is the prototype of the alike() function that you will use in your code.
List alike(List list);

Note: Your Submission must include:


1. A working MakeFile (Dev-C++ project File).
2. All the Source Code (.h and .cpp files) necessary to compile and run your program.
3. Submit all the files in a zip folder and name it to your registration number.

You might also like