Question: Assume class SimpleLinked List is defined as follows: public class SimpleLinkedList protected Node first; protected Node last; protected int count: public SimplelinkedList() { first =

Assume class SimpleLinked List is defined as follows: public class SimpleLinkedList protected Node first; protected Node last; protected int count: public SimplelinkedList() { first = null; last = null; count = 0; ) public boolean isEmpty return first = null; } public int length({ return count: > public void printot Node current - first: while (current l- null) { System.out.print(current.info + " "); current -current.link: public boolean search(int searchinfo) { Node current first; boolean found = false; while (current in null && Ifound) if (current.info == searchinfo) ( found = true; } else { current current.link; } return found; } return found; } public void insert(int newInfo) { Node newNode - new Node(newInfo): if (isempty() { first = last = newNode; } else { newNode.link = first; first = newNode: } count++; Add a method to Simplelinkedlist that prints the numbers in the nodes that are in odd positions in a linked list: public void printOddNodesElements(X
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
