Question: Java Homework Help: The book is Data Structures and Algorithms 6th Edition. The assignment deals with Recursion. Here are the instructions: In this assignment you
Java Homework Help:
The book is Data Structures and Algorithms 6th Edition.
The assignment deals with Recursion.
Here are the instructions:
In this assignment you are to create a Recursion Class that will implement the following recursive algorithms:
Implement a recursive algorithm to compute the nth Harmonic number defined as:
Hn = summation: n: k=1: 1/k
Implement Isabels technique for summing the values in an array of n integers as described in problem C-5.24 on page 223 of the textbook.
This is my code for Isabel's Technique
public int sumArray(int[] A){
if(A.length==1)
return A[0];
else{
int B[] = new int[A.length/2];
for(int i=0;i B[i]=A[2*i]+A[2*i+1]; } return sumArray(B); } } Implement a recursive method with calling signature find(path) that reports all entries of the file system rooted at the given path. Note that a path would may look something like: C:\Windows\DigitalLocker. Here's my code for find(path) public String find(File path, String fileName) { String str = ""; File[] fileList = path.listFiles(); if (fileList != null) { for (int i = 0; i < fileList.length; i++) { if (fileList[i].isDirectory()) { str+=find(fileList[i], fileName); } else if (fileName.equalsIgnoreCase(fileList[i].getName())) { str += fileList[i].getParentFile() +"\\"+ fileName +" "; } } } return str; } Create a Recursion_Client Class that will fully test each of the recursive methods that you created above in an interactive fashion. This class should: Use a JOpitonPane to ask the user which algorithm they wish to test. Use a JOptionPane to ask the user for any parameters/values needed for the test.For Isabels technique the parameter should be the paththat contains a comma separated list of integers values that will make up the array. When you read in the values from the file you should skip any values that are not integers. If the user enters a file that does not exist your program should inform the user that the file does not exist and ask the user to enter a correct filename or quit back to algorithm selection. Output for each test should be shown in the system console and must include: The name of the algorithm being tested. The parameters entered by the user Values used if different from parameters (e.g. the contents of the array read in for Isabels technique). Error messages give to the user (e.g. file not found) The results of the test. Note that the JOptionPane interactions will not be captured in the system console. At the end of a test the user should be given the options of running another test or exiting the program.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
