Professional Documents
Culture Documents
General Instructions: Argue logically. Write it in a manner that explains your logic very
clearly. Do not miss steps in between.
Task 1 Implement a singly linked list in C/C++. Implement the following operations
1. Compute the Length of a Linked List. It also can print the linked list given an appropriate flag.
4. Insert a node in the middle of the list given its position. If p is the position parameter then the
inserted node will be the p th node in the list after insertion. Thus if p = 1 then a new node will
be inserted in the beginning. If p exceeds the length of the list then it will be inserted at the end
of the list with a warning about p exceeding the length of the list.
7. Delete a node from the middle of the list. If p is the position then the p th node from the current
list will be reduced by 1.
Task 2 Find nth node from the end of a singly Linked List. Implement it in a manner that you can do
it in one pass.
Task 3 Given a singly linked list, reverse the linked list.