Question: ASAP. Java questions: ques 1: void fun1 ( Node curr) que 2: long fictitious(int n) { if (n == 0|| n==1 || n==2) return n;
ASAP.
Java questions:
ques 1:
void fun1 ( Node curr)
que 2:
long fictitious(int n)
{
if (n == 0|| n==1 || n==2) return n;
return fictitious (n - 1) + fictitious (n - 2)+ fictitious(n - 3);
}
Suppose n was a very large integer( like 100). What technique would you use to maximize the performance of the recursive code implemented above?
| 1.Use multiple base cases | ||
| 2.Use memoization | ||
| 3.Call another recursive method to help | ||
| 4.Use 1 extra base case |
{
if (curr == NULL)
return;
fun1(curr.next);
System.out.print(" "+curr.data);
}
| 1.Prints all nodes of the linked list in order | ||
| 2.Prints alternate nodes in reverse order | ||
| 3.Prints all nodes of the linked list in reverse order | ||
| 4.Prints alternate nodes of the Linked List |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
