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 (){
}
Node(int i){
data=i;
}
}
```
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, 30,55,5, and 20, then the method should return 2 because there are two odd numbers (55 and 5) in the linked list. You must use the following header.
static int countOdds (Node head)\{
` ` ` You have the following class. class Node {

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 Programming Questions!