Question: ` ` ` You have the following class. class Node { int data; Node next; Node ( ) { } Node ( int i )
You have the following class.
class Node
int data;
Node next;
Node
Nodeint i
datai;
Write a recursive method that will return the count of odd numbers in the data variables of the Node objects in a linked list.
For example, if the linked list contains the following numbers as the data variables of the Node objects, and then the method should return because there are two odd numbers and in the linked list. You must use the following header.
static int countOdds Node head
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
