Data Structures - CS301 Fall 2006 Assignment 01
Data Structures - CS301 Fall 2006 Assignment 01
WWW.VUTUBE.EDU.PK
Assignment No. 1: Linked List
Subject: Data Structures Assigned: 11-10-2006 Assignment Marks: 15
squish( )
The squish() method performs as described below.
squish() takes the list and, wherever two or more consecutive items are equal, it removes duplicate
nodes so that only one consecutive copy remains. Hence, no two consecutive items in this list are
equal upon completion of the procedure. After squish() executes, the list may well be shorter than
when squish() began. No extra items are added to make up for those removed.
Here is the prototype of the squish() function that you will use in your code.
twin( )
The twin() method performs as described below.
twin() 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 [ 3 7 4 2 2 ], the output list is [ 3 3 7 7 4
4 2 2 2 2 ].
Here is the prototype of the twin() function that you will use in your code.