Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java code please 0 public class RecursionTestclass { 1 20 _3 * Here I have provided an example of one of the tests that I

Java code please

image text in transcribedimage text in transcribed

0 public class RecursionTestclass { 1 20 _3 * Here I have provided an example of one of the tests that I 4 * would write. For each of your tests, leave a brief comment 5 * above the test specifying its purpose. For example, for this * test, I might write, "indexOf_testi tests when s2 is not a _7 * substring of s1. This should return -1.". */ ge @Test public void test_indexOf_test1() { 21 int result = Recursion.indexOf("Hello", "World"); 22 System.out.println("indexOf(Hello, World), got + result); 23 assertEquals(-1, result); 24 } 25 26 } 7 11 System.out.println(Recursion.indexOf("Hello", "10")); // 3 Stack stack = new Stack(); stack.push(2); stack.push(3); stack.push(4); stack.push(55); stack.push(6); stack.push(17); stack.push(); System.out.println(Recursion.removeEvenNumbers (stack, 2)); // 2 System.out.println(stack); // [2, 3, 4, 55, 17] System.out.println(Recursion.evenDigits (-1364035)); // 640 String expr = "(((1+2)*(3+1))+(1*(2+2)))"; Queue q = new LinkedList(); for (char ch: expr.toCharArray()) { q.add(ch); } System.out.println(Recursion.evaluate(q)); // 16 System.out.println(stack); // [2, 3, 4, 55, 17] Recursion.repeatStack(stack); System.out.println(stack); // [2, 2, 3, 3, 4, 4, 55, 55, 17, 17] Queue q2 = new LinkedList(); q2.add(34); 42.add(15); q2.add(0); Recursion.doubleElements(q2); System.out.println(92); [68, 30, 0] 0 public class RecursionTestclass { 1 20 _3 * Here I have provided an example of one of the tests that I 4 * would write. For each of your tests, leave a brief comment 5 * above the test specifying its purpose. For example, for this * test, I might write, "indexOf_testi tests when s2 is not a _7 * substring of s1. This should return -1.". */ ge @Test public void test_indexOf_test1() { 21 int result = Recursion.indexOf("Hello", "World"); 22 System.out.println("indexOf(Hello, World), got + result); 23 assertEquals(-1, result); 24 } 25 26 } 7 11 System.out.println(Recursion.indexOf("Hello", "10")); // 3 Stack stack = new Stack(); stack.push(2); stack.push(3); stack.push(4); stack.push(55); stack.push(6); stack.push(17); stack.push(); System.out.println(Recursion.removeEvenNumbers (stack, 2)); // 2 System.out.println(stack); // [2, 3, 4, 55, 17] System.out.println(Recursion.evenDigits (-1364035)); // 640 String expr = "(((1+2)*(3+1))+(1*(2+2)))"; Queue q = new LinkedList(); for (char ch: expr.toCharArray()) { q.add(ch); } System.out.println(Recursion.evaluate(q)); // 16 System.out.println(stack); // [2, 3, 4, 55, 17] Recursion.repeatStack(stack); System.out.println(stack); // [2, 2, 3, 3, 4, 4, 55, 55, 17, 17] Queue q2 = new LinkedList(); q2.add(34); 42.add(15); q2.add(0); Recursion.doubleElements(q2); System.out.println(92); [68, 30, 0]

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_2

Step: 3

blur-text-image_3

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

Knowledge Discovery In Databases

Authors: Gregory Piatetsky-Shapiro, William Frawley

1st Edition

0262660709, 978-0262660709

More Books

Students also viewed these Databases questions

Question

Find the derivative of y= cos cos (x + 2x)

Answered: 1 week ago