Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider the following definition of a class MyNode, and a Linked List MyLinkedList created from objects of the class MyNode public class KyNode public class
Consider the following definition of a class MyNode, and a Linked List MyLinkedList created from objects of the class MyNode public class KyNode public class MyLinkediist T private int number: private MyNode next; public HyNode (int n) private, Mynode head; public MylinkedListo ( head null; numberni next nulli I/ Mylinkedlist) public boolean isEmpty ( // Mynode ) public void setNext (Mynode nextNode) 7/saEmpty) next nextNode; public void insertrirst (Mynode nextNode) ( ) / inserto public void print o i // setNexto public Mynode getNexto return next // gethext0) public void setNumber (int n) number = n; // print () // setNnumber O public int getkumber ) t return number ) I1 Mylinkedlist 17 getNumber (O ) II Mynode A. In Mylinkedlist class, write a method called countEvenNodes that will count the number of nodes in the list having even values stored in their attribute number. The signature of the method is provided. public int countEvenNodes B. In the class MyLinkedList, write a method called reverseLists that will reverse the list. public void reverseLists (MyLinkediist list1, MyLinkediist list2) t
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started