Question: Complete method deleteNegatives() of the List class given below. The method should remove every negative number from the list. Do not use any other methods
Complete method deleteNegatives() of the List class given below. The method should remove every negative number from the list. Do not use any other methods unless you write them yourself. You can write iteratively or recursively, in any style. You may use only one loop or recursive helper function. Here are some examples of what this method should do. BEFORE AFTER 0 0 (10) (10) (-10) 0 1-10,20,30,40] [20,40) (10, -20,30,40,50) (10,30,50) public class List private Node first; // If list is empty, then first - null private class Node private double item; private Node next; public void deletelegatives
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
