2023 Java Recursive Problems 4 problems Problem I We define the Shaw strings as follows 1 abb | Assignment Collections

Computer Science 2023 Java Recursive Problems

2023 Java Recursive Problems 4 problems Problem I We define the Shaw strings as follows 1 abb | Assignment Collections

                         
Java Recursive Problems (4 problems):

Problem  I.    We define the Shaw strings as follows:
      1. abb is a Shaw string.
      2. bca is a Shaw string.
      3. If S is a Shaw string, so is SaS.
      4. If U and V are Shaw strings, so is UbV.

Here a, b, c are constants and S,U,V are variables. In these rules,
the same letter represents the same string. So, if S = abb,
rule 3 tells us that abbaabb is a Shaw string.
In rule 4, U and V represent Shaw strings, but they may be different.

Write the method

public static boolean isShaw(String in)
that returns true if in is a Shaw string and false otherwise.

Problem II.

public static  double getLargest(double [] a, int low, int high)

that returns the largest number in the array slice a[low:high].

If low > high, it throws an IllegalArgumentException. Otherwise, it checks if
the slice has 1 item. If so, it returns that value.

If the slice has 2 or more items, it divides the slice into 2 equal subslices,
computes the largestvalues of the 2 subslices and returns the largest of the 2 values.

Problem III. We define the Raju numbers as

         Raju(0) = 1
         Raju(1) =1
         Raju(n) = Raju(n-1) + Raju(n-2) + 3 if n >= 2

public static long Raju(int n)

returns the n-th Raju number. If n < 0, the method throws an IllegalArgumentException.     

Problem IV. Write the method

public static int binarySearch(double[] arr, int low, int high, double inq)

that search the array slice arr[low:high] for an occurrence
of inq. If inq occurs in arr, return an index i such that
arr[i] == inq. Otherwise, return -1.

Assume that arr is sorted in increasing order. Write a recursive version of this method.

The Output:
run:
Checking Hw
==============

We check isShaw
isShaw(“abbbabb”) is true
isShaw(“abbbaca”) is false
isShaw(“abbbabbaabbbabb”) is true
isShaw(“abbbbcabca”) is false
isShaw(“abbbbcaaabbaabb”) is false
isShaw(“abbbbcaabca”) is true

We test getLargest
The array is arr = { 6.9, -10.3, 6.7, 2.5, 16.4, -3.1}.
The largest of arr[0:6] is
We got an illegal argument exception.
The largest of arr[2:1] is
We got an illegal argument exception.
The largest of arr[2:2] is 6.7
The largest of arr[0:4] is 16.4

We test the Raju numbers.

We test the Raju numbers.
Raju(-1) is
We got an illegal argument exception.
Raju(2) is 5
Raju(4) is 17
Raju(10) is 353

We test binary search.
The input array is table = { 2, 4, 6, 8, 10, 12, 14 }.
2 was found in table[0:6] at index 0
3 was found in table[0:6] at index -1
4 was found in table[2:6] at index -1
12 was found in table[2:5] at index 5

This is all folks. I hope that your program worked.
BUILD SUCCESSFUL (total time: 2 seconds)

 

We give our students 100% satisfaction with their assignments, which is one of the most important reasons students prefer us to other helpers. Our professional group and planners have more than ten years of rich experience. The only reason is that we have successfully helped more than 100000 students with their assignments on our inception days. Our expert group has more than 2200 professionals in different topics, and that is not all; we get more than 300 jobs every day more than 90% of the assignment get the conversion for payment.

Place Order Now

#write essay #research paper #blog writing #article writing #academic writer #reflective paper #essay pro #types of essays #write my essay #reflective essay #paper writer #essay writing service #essay writer free #essay helper #write my paper #assignment writer #write my essay for me #write an essay for me #uk essay #thesis writer #dissertation writing services #writing a research paper #academic essay #dissertation help #easy essay #do my essay #paper writing service #buy essay #essay writing help #essay service #dissertation writing #online essay writer #write my paper for me #types of essay writing #essay writing website #write my essay for free #reflective report #type my essay #thesis writing services #write paper for me #research paper writing service #essay paper #professional essay writers #write my essay online #essay help online #write my research paper #dissertation writing help #websites that write papers for you for free #write my essay for me cheap #pay someone to write my paper #pay someone to write my research paper #Essaywriting #Academicwriting #Assignmenthelp #Nursingassignment #Nursinghomework #Psychologyassignment #Physicsassignment #Philosophyassignment #Religionassignment #History #Writing #writingtips #Students #universityassignment #onlinewriting #savvyessaywriters #onlineprowriters #assignmentcollection #excelsiorwriters #writinghub #study #exclusivewritings #myassignmentgeek #expertwriters #art #transcription #grammer #college #highschool #StudentsHelpingStudents #studentshirt #StudentShoe #StudentShoes #studentshoponline #studentshopping #studentshouse #StudentShoutout #studentshowcase2017 #StudentsHub #studentsieuczy #StudentsIn #studentsinberlin #studentsinbusiness #StudentsInDubai #studentsininternational