You are on page 1of 1

Lab 05

Consider Linked List class shared after last class, having dummy node at start and end pointer pointing
to last node (if any, otherwise to NULL). Implement following functions in Linked List class:

a. Modify add & delete functions such that dummy node at start should contain count of total
nodes excluding dummy node

b. Add split function that will traverse the list and add every node with value greater than 50
into two nodes, where both nodes will have same value, in case of even value, otherwise, first
node will have larger value. See example below:
List have nodes with following values before function call:
23 59 37 46 64 29
List have nodes with following values after function call:
23 30 29 37 46 32 32 29

c. Write a function to verify whether or not given list is palindrome or not. Palindrome means
list has same output whether traverse from start to end or end to start (Excluding dummy
node)

d. Write a function to remove all nodes with negative values

e. Write a function to receive an array and size, add all array values not already existing in the
list. See example below:
List have nodes with following values before function call:
23 59 37 46 66 29
Array (function parameter) has following values
26 36 46 56 66
List have nodes with following values after function call:
23 59 37 46 66 29 26 36 56

f. Write a function to print linked list values in pair. See example below:
List have nodes with following values:
23 59 37 46 66 29
Output of the function will be:
23 59
59 37
37 46
46 66
66 29

You might also like