Question: I am currently learning about LinkedList, and need help completing these few questions to make sure I am doing them correct. Any help is appreciated,

I am currently learning about LinkedList, and need help completing these few questions to make sure I am doing them correct. Any help is appreciated, and I will leave a positive review!

Programs Needed to complete these questions -

ListNode:

public class ListNode implements Linkable { private Comparable listNodeValue; private ListNode nextListNode; public ListNode() { listNodeValue = null; nextListNode = null; } public ListNode(Comparable value, ListNode next) { listNodeValue=value; nextListNode=next; } public Comparable getValue() { return listNodeValue; } public ListNode getNext() { return nextListNode; } public void setValue(Comparable value) { listNodeValue = value; } public void setNext(Linkable next) { nextListNode = (ListNode)next; } }

Linkable:

public interface Linkable { Comparable getValue(); Linkable getNext(); void setNext(Linkable next); void setValue(Comparable value); }

1. Complete method countOdds()

I am currently learning about LinkedList, and need help completing these few2. Complete method removeNode(Object obj).

questions to make sure I am doing them correct. Any help is

//method countOdds will return the count of all odd nums in list public int countOdds (ListNode list) { private ListNode theList; //instance variable Example 1/method removeNode will remove the 1" occurrence of obj public void removeNode (Object obj) { 1/original list 1 -> 5 -> 3 -> 4 -> 7 -> null //value to remove 5 1/original list after remove 1 -> 3 -> 4 -> 7 -> null

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!