Write a function noduplicates that insert


Extend the class linkedListType by adding the following operations:
1- Write a function noDuplicates that insert an item but before inserting the item it checks whether the item is already in the list. If the item to be inserted is already in the list, the function outputs an appropriate error message.
2- Write a function that returns the info of the kth element of the linked list. If no such element exists, output an appropriate message.

Write a program to test your functions.


Sample Input/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 are trying 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 are trying 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


Press any key to continue... 

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Write a function noduplicates that insert
Reference No:- TGS088274

Expected delivery within 24 Hours