TD 4 Linked List
TD 4 Linked List
5. Delete the node containing the value 5. 7. Find the merging point of two linked lists.
Input:
6. Implement a function to search for a give value List 1: 1->3->5->7->9->11->15->17
V in the list. List 2: 2->4->6->15->17
Output: The merging point is 15.
7. Update the node containing 3 by changing its
value to 77. 8. Reverse a linked list in groups of k nodes.
Input: 10->20->30->40->50->60->70, k = 3
8. Print the list after each operation. Output: 30->20->10->60->50->40->70
9. Access the nth item in the list 9. Merge two sorted linked lists into a single sorted
list.
10. Implement a function to calculate and return Input:
the sum of all node values. List 1: 1->5->9->14->20
List 2: 2->6->10->15->25
Output: 1->2->5->6->9->10->14->15->20-
Exercise 2 >25
Implement the following routines for a singly linked
list: Exercise 3
1. Find the middle node(s) of a linked list. 1. Implement a linked list that stores the following
sequence of numbers:
2. Check if a linked list is a palindrome.
3→8→1→4
3. Remove duplicate elements from both sorted
and unsorted linked lists. (Head → Tail)
2. Modify your implementation to make the list 3. Calculate and display the general average of the
circular so that the last node points back to section by calling the Moy_section(L) func-
the first node. tion, which computes and returns the overall
average of all students.
3. Insert the value 5 after the node containing 8 .
4. Display the list of admitted students using the
4. Delete the node containing 1.
display_admitted(L) procedure. This pro-
5. Traverse the circular linked list starting from cedure should print the details of students who
the head and print the elements. meet the admission criteria.
3 8 1 4 Exercise 6
A web browser stores its history using a doubly
linked list, where each visited webpage is a node
containing: