Question: simple data structures Write a c++ routine that prints the elements located at odd indices in a singly linked list. Examples - If your list

simple data structures
Write a c++ routine that prints the elements located at odd indices in a singly linked list. Examples - If your list is: 1 > 234 5 then you will need to print: 1, 3, 5 (since 1 is located at index 1, 3 is at index 3, and 5 is at index 5) - If your list is: 432 1 then you will need to print: 4, 2 (since 4 is located at index 1, and 2 is at index 3) You are printing values found in odd indices and not the odd numbers. - You will need to implement the linked list class we saw in class. However, for the purpose of this assignment, implementing the constructor, the add function, and perhaps the print function, should suffice. Assume your lists contain integers. Do NOT use STL list/iterator to write your code. Make sure your code handles edge cases (empty lists and lists with one element)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
