Starting from:

$34.99

CS103 Assignment 2 Solution

ASSIGNMENT - II
(FOR THE SECOND AND THE THIRD LAB SESSIONS)
Assignments to be completed during lab sessions
1. Create an array of integers with dynamic memory allocation. The size of the arrayis user input. Read the elements of the array as inputs. Write a function to perform insertion sort on that array.
2. Write functions to perform the following operations on a singly linked list.
(a) Write a function to add an element at the beginning of the list.
(b) Write a function to print the elements in the list.
(c) Write a function to count the number of elements in the list.
(d) Write a function to remove the first element of the list.
(e) Write a function to add an element at the end of the list.
(f) Write a function to remove the last element of the list.
(g) Write a function to add an element at a given position of the list.
(h) Write a function to remove the element at a given position of the list.
(i) Write a function to add data after the first occurrence of a given key value inthe linked list.
(j) Write a function to remove the first occurrence of a given data of the list.
(k) Write a function to reverse the elements in the list.
(l) Write a function to reverse the elements in the list without creating a new list.
(m) Write a function to insert an element in a sorted list such that the final list isalso sorted.
(n) Write a function to sort the elements in a list.
Additional assignments
1. Write functions to perform the following operations on one/two singly linked list(s).
(a) Write a function to merge two lists.
(b) Write a function to get/access the data at the ith node of the list.
(c) Write a function to detect if there is a loop in a given list.
(d) Write a function to rectify a detected loop in a given faulty list.
(e) Write a function to merge two sorted linked lists such that after merging theresultant list is also sorted.
(f) Use recursion to print the list.
(g) Use recursion to print the list in the reverse order.
(h) Use recursion to reverse the list.

More products