Add tests for merge sort (#3715)

This commit is contained in:
shlokam
2022-11-01 00:56:49 +05:30
committed by GitHub
parent 3542f1c4c1
commit 9e7456a2a8
3 changed files with 136 additions and 0 deletions

View File

@ -0,0 +1,20 @@
package com.thealgorithms.strings;
/**
* Reverse String using Recursion
*/
public class ReverseStringRecursive {
/**
* @param str string to be reversed
* @return reversed string
*/
public static String reverse(String str)
{
if(str.isEmpty()){
return str;
} else {
return reverse(str.substring(1))+str.charAt(0);
}
}
}