1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
OlgaM077 [116]
3 years ago
6

Write a recursive method public static String reverse(String str) that computes the reverse of a string. For example, reverse("f

low") should return "wolf". Hint: Reverse the substring starting at the second character, then add the first character at the end. For example, to reverse "flow", first reverse "low" to "wol", then add the "f" at the end.
Computers and Technology
1 answer:
Aneli [31]3 years ago
5 0

Answer:

Explanation:

StringRecursiveReversal.java

public class StringRecursiveReversal {

   static String reverse1 = "";

   public static String reverse(String str){

       if(str.length() == 1){

           return str;

       } else {

           reverse1 += str.charAt(str.length()-1)

                   +reverse(str.substring(0,str.length()-1));

           return reverse1;

     }

   }

   public static void main(String a[]){

       StringRecursiveReversal srr = new StringRecursiveReversal();

       System.out.println("Result: "+srr.reverse("flow"));

   }

}

Output :

Result: wolf

You might be interested in
A(n) ____________________ or cryptosystem is an encryption method or process encompassing the algorithm, key(s) or cryptovariabl
Black_prince [1.1K]

Answer:

A(n)  <u>Cipher</u> or crypto-system is an encryption method or process encompassing the algorithm, key(s) or crypto-variable(s), and procedures used to perform encryption and decryption.

Explanation:

  • Cryptography is such a technique that is used for the secure transfer of the information. We make codes for this purpose.
  • Cryptosystem is such a system in cryptography is simply an encryption method that has three algorithms. One algorithm is used for the generation of key, one for encryption and decryption.
  • Encryption is a process of converting the information in a data that is not understandable and decryption, this non-understandable data is converted into information so that we can read it.  
3 0
3 years ago
Implement a function called merge that does the following in C#:
levacccp [35]

Answer:

Check the explanation

Explanation:

using System;

using System.Collections.Generic;

using System.Linq;

public class Problem2

{

public static IEnumerable<int> merge (IEnumerable<int> input1, IEnumerable<int> input2, IEnumerable<int> input3)

{

IList<int> list = new List<int>();

foreach (int i in input1)

{

if(i%3==0 && ! list.Contains(i))

list.Add(i);

}

foreach (int i in input2)

{

if(i%3==0 && ! list.Contains(i))

list.Add(i);

}

foreach (int i in input3)

{

if(i%3==0 && ! list.Contains(i))

list.Add(i);

}

return list;

}

}

public class Problem2Demo{

static void Main (string[] args)

{

Random rnd = new Random ();

var list1 = Enumerable.Range (1, 10).Select (i => (rnd.Next () % 15) + 1);

var list2 = Enumerable.Range (1, 10).Select (i => (rnd.Next () % 15) + 1);

var list3 = Enumerable.Range (1, 10).Select (i => (rnd.Next () % 15) + 1);

var answer = Problem2.merge (list1, list2, list3);

foreach (int i in answer)

{

Console.WriteLine (i);

}

}

Kindly check the attached output image below.

8 0
3 years ago
Eric would like to have a callout text box that makes it look as if the character in an image is speaking. Which object should h
jeka57 [31]
Picture or word art.
5 0
2 years ago
Read 2 more answers
A study guide can be created
choli [55]

Answer:

C, Both of these.

Explanation:

You can take notes either way. It's just your preference. Hope this helps :)

7 0
3 years ago
Read 2 more answers
Jake is photographing his pet puppy. He wants to preview the image the camera will capture. What part of the camera that is insi
german

A. i think that is right

3 0
2 years ago
Read 2 more answers
Other questions:
  • How do you know if you get a phone call that is a scam
    8·2 answers
  • What key combination in excel takes you back to the first cell
    7·1 answer
  • What operator is used to create a validation rule? A. – B. / C. &lt; or &gt; D. +
    12·1 answer
  • You can use the results from a search on a database in all of these ways except to ____.
    11·2 answers
  • *Please* read before answering.
    14·1 answer
  • Which of these is one of the primary concerns for protecting your family when online?
    9·2 answers
  • Create a two functions: first called grocery_cost(food), where food can be one item or a list of items from the stock and price
    7·1 answer
  • My phone takes forever to load the ads, does anyone else have this problem? Is there a way to fix it? I’ve tried getting another
    12·2 answers
  • You learned that "The CPU interacts with memory in a process that is known as
    6·1 answer
  • Years ago when working a helpdesk, the most common question asked, almost daily, was about resetting passwords. What type of kno
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!