$29
Purpose
To prac(ce wri(ng code involving linked lists.
Direc4ons:
First download the file LinkedListPrac(ceProblem.zip and open it in the IDE of your choice, such as repl.it. Read through the code to make sure you understand how it works.
Your task is to implement a public method in the LinkedList class called removeN that takes an integer called element that indicates the element to be removed from the list and an integer parameter n that indicates the number of copies of that element to remove, if possible. The method should return a boolean indica(ng whether or not the removeN opera(on was successful. Be sure to also update the size of the list appropriately.
If there are at least n occurrences of the element in the list, then n nodes with that element are removed star(ng from the beginning of the list and moving to the right node by node and the method returns true. If there aren’t enough occurrences of the element in the list, then the list should not be altered and the method should return false.
Write a driver program that thoroughly tests your method.
Examples:
list is 3, 4, 7, 6, 3, 2, 9, 6, 3, 6
list.removeN(6, 2) returns true and list is now 3, 4, 7, 3, 2, 9, 3, 6
list is 3, 4, 7, 6, 3, 2, 9, 6, 3, 6
list.removeN(6, 4) returns false and list is s(ll the same, because there are not four occurrences of the element 6 in the list