Question: Write the answers below. For problem 1, write an instance method of the Playground that would compute the difference between max and min values. Show


Write the answers below. For problem 1, write an instance method of the Playground that would compute the difference between max and min values. Show how to write the function, using hwk4 as an invoking instance. For problem 2, find the output of the function call: StdOut.println(recur(5)); For problem 3, write the client pseudocode to reverse the queue q1 and remove all even numbers from the stack s1. There is a reference example for reference.
1. The Playground class (algs13) represents a linked-list of doubles, illustrated below. first 5 13 18 12 5 An instance could be created as: Playground hw4 = new Playground(); Assume that the instance is somehow populated with data (as in the above figure). Write an instance method of the Playground class that would compute the difference between the maximum and minimum values of a Playground instance. (the answer for the above figure would be: 18-5 = 13) a) Show how to call your function; use hw4 as the invoking instance. b) Write the function here. 2. Show the output of the function call: Stdout.println( recur(5) ); public static String recur(int n) { if (n
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
