Add a new method to your TSortedList called removeDuplicates(). The method should scan the linked list and remove any duplicates. Note that the list is already sorted. So, you have to just remember...


Write the code in C++


Add a new method to your TSortedList called removeDuplicates(). The method should scan<br>the linked list and remove any duplicates. Note that the list is already sorted. So, you have<br>to just remember the last element seen in order to decide whether the next element is a<br>duplicate or not.<br>Test your method with the following input to {7,15, 3, 2, 1, 3, 7, 15} an empty sorted list.<br>After invoking removeDuplicates() and printing the resulting list, the output should be<br>{1,2,3,7,15}.<br>

Extracted text: Add a new method to your TSortedList called removeDuplicates(). The method should scan the linked list and remove any duplicates. Note that the list is already sorted. So, you have to just remember the last element seen in order to decide whether the next element is a duplicate or not. Test your method with the following input to {7,15, 3, 2, 1, 3, 7, 15} an empty sorted list. After invoking removeDuplicates() and printing the resulting list, the output should be {1,2,3,7,15}.

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here