Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions

Question

Define a copyright and identify what a copyright can protect.

Answered: 1 week ago