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
Step: 1
Get Instant Access to Expert-Tailored 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