Question
Expand class linkedListType by adding following operations-
1- inscribe a function noDuplicates that insert an item except before inserting the item it checks whether the item is already in listing. If the item to be inserted is already in the list, the function outputs an appropriate error message.
2- Write down a function that returns the info of the kth element of the linked list. If no such factor exists, output an appropriate message.
Note down a program to test your functions.
Sample Input or output
Enter the size of the List: 6
Enter a number to be inserted: 5
Enter a number to be inserted: 7
Enter a number to be inserted: 5
Item you try to insert is already in the list.
Enter a number to be inserted: 9
Enter a number to be inserted: 1
Enter a number to be inserted: 7
Item you try to insert is already in the list.
Enter a number to be inserted: 10
Enter a number to be inserted: 2
The Content of the list is:
5 7 9 1 10 2
Enter an index to return its value: 3
The value of index 3 is : 1