Question: You have the following doubly linked list node: class Node{ int data; Node next; Node prev; } Write a recursive method that will perform a
You have the following doubly linked list node:
class Node{
int data;
Node next;
Node prev;
}
Write a recursive method that will perform a special type of summation on a doubly linked list L of
length n :

L (i ) indicates the data value in the i th Node of the linked list L . Location i starts from zero.
Example 1: If the linked list contains f 10, 2, 3, 4, 5g , the method must do the following summation
10 5 + 2 4 + 3 3 = 67
Example 2: If the linked list contains f 10, 2, 3, 4g , the method must do the following summation
10 4 + 2 3 = 46
The method header is provided below.
public static int specialSum(Node head, Node tail){
}
(n-1)/2 ) LG) L(n-1-1 2-0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
