Starting from:

$34.99

CS103 Assignment 3 Solution


Assignments to be completed during lab sessions
1. Write functions to perform the following operations on a doubly 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 both with forward and backward traversals.
(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 doubly linkedlist(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 merge two sorted linked lists such that after merging theresultant list is also sorted.
(d) Use recursion to print the list.
(e) Use recursion to print the list in the reverse order.
(f) Use recursion to reverse the list.
(h) Given a doubly-linked list and a positive integer n, write a function to rotate the linked list clockwise by n modulo l nodes, where l is the length of the list.
2. Write functions to perform the following operations on a circular 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.
3. Write functions to perform the following operations on a circular doubly 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 both with forward and backward traversals.
(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.

More products