Question: paelseeeeeeeeeeeeee in java Write a java method called removeDistinct that receives the head of a singly linked list and removes nodes containing distinct values (i.e.

paelseeeeeeeeeeeeee in java
Write a java method called "removeDistinct" that receives the head of a singly linked list and removes nodes containing distinct values (i.e. nodes having distinct values will be removed and nodes containing duplicate values will not be removed). The linked list class have only the followings: 1) a public head attribute which is a reference to the first node node has next and data attributes) 2) a public size attribute which is a count of nodes in the linked list. 3) Two contructors 4) boolean add(Object o, int index) // adds a node at a specific index. If index size the method returns false and returns true otherwise. 5) boolean remove(Object o)// removes the first existence of the node containing data equal to o. if no node contains a value equal to the method returns false
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
