How could I write a recursive method that returns a string in reverse order for java? Is this ok? - index of tester woman jpg
I have a company asked me to write a recursive method to a string in reverse order, then you test the method with the test program ... He said that the chain index has poisition parameters ... I'm just a naive programmer, and I wonder whether this might work, or you can use a quick sort method, and how?
Tuesday, February 2, 2010
Index Of Tester Woman Jpg How Could I Write A Recursive Method That Returns A String In Reverse Order For Java? Is This Ok?
Subscribe to:
Post Comments (Atom)
3 comments:
Well, it's good to know that the String class has a method that includes the length of the chain right? As a "word.length ()". Remember parentheses
The strings have a method called string is an abbreviated version of the chain, depending on the arguments that has given you. A 2 arguments, an index is the starting point of the chain and the second is the completion rate of the substring. For example, if a string "word" contains "Hello World", and I "word.substring (0, 3)" returns "Hello". It contains the character at the last clue she has, if I had said, "hell".
You can create a loop that goes back to collect the sign at the end of the chain.
I have not written in Java on time, but I'll write my answer in C:
C can not turn the tables so that I teach by using:
myStringReverse void (mystring char *, int n);
int main () (
char myString [] = what user input may
myStringReverse (myString);
then print myString is done in Java
return 0;
)
/ / Index swaps with the n-th index 1th
myStringReverse void (mystring char *, int n) (
char temp = myString [n];
myString [n] = myString [1];
myString [n-1] = temp;
if (n> 0) (
myStringReverse (mystring, n-1) / / It's like a loop that goes from N to 1, n --
)
)
How about:
Invert (string str) (
if (str.length () == 1) return str;
Local String = "";
for (int i = str.length () -1; \\ \\ \\ \\ k \\ \\ \\ \\ u0026lt j = 0, k -) (
(str.Substring local + = k, k +1);
)
return local;
)
+ Add
I realized that this is not recursively!
Post a Comment