Question: Extend the source code for the Singly Linked List (attached to the quiz description) by adding a member function to find the middle value of

Extend the source code for the Singly Linked List (attached to the quiz description) by adding a member function to find the middle value of the elements in the List. Also, extend the main function given in the source code to call the member function and print the return value (i.e., the middle value of the elements in the List). Test your program with both even and odd values for the size of the Linked List. If 'n' is the size of the Linked List, the program should print the n/2th element in the Linked List if 'n' is even and print the (n-1)/2th element in the Linked List if 'n' is odd. You should test the program with two values (an odd value and an even value) for the size of the Linked List that could range anywhere from 10 to 20. The maximum value for any element in the Linked List is 50. Extend the source code for the Singly Linked List (attached to the quiz description) by adding a member function to find the middle value of the elements in the List. Also, extend the main function given in the source code to call the member function and print the return value (i.e., the middle value of the elements in the List). Test your program with both even and odd values for the size of the Linked List. If 'n' is the size of the Linked List, the program should print the n/2th element in the Linked List if 'n' is even and print the (n-1)/2th element in the Linked List if 'n' is odd. You should test the program with two values (an odd value and an even value) for the size of the Linked List that could range anywhere from 10 to 20. The maximum value for any element in the Linked List is 50
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
