Difference between revisions of "Tail Recursion Assignment"
Jump to navigation
Jump to search
(Created page with "=Code To Implement= ==Max== {{JavaToImplement|Reverse|reverse|tail.assignment}} <nowiki>public static <E> ImmutableList<E> reverse(ImmutableList<E> original)</nowiki> =Test=...") |
|||
Line 1: | Line 1: | ||
=Code To Implement= | =Code To Implement= | ||
− | == | + | ==Reverse== |
{{JavaToImplement|Reverse|reverse|tail.assignment}} | {{JavaToImplement|Reverse|reverse|tail.assignment}} | ||
<nowiki>public static <E> ImmutableList<E> reverse(ImmutableList<E> original)</nowiki> | <nowiki>public static <E> ImmutableList<E> reverse(ImmutableList<E> original)</nowiki> | ||
+ | |||
+ | You will want to build a [https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html private] [https://docs.oracle.com/javase/tutorial/java/javaOO/classvars.html static] helper method which is tail recursive. | ||
=Test= | =Test= | ||
{{TestSuite|ReverseTestSuite|tail.assignment}} | {{TestSuite|ReverseTestSuite|tail.assignment}} |
Revision as of 06:30, 1 October 2020
Code To Implement
Reverse
class: | Reverse.java | ![]() |
methods: | reverse | |
package: | tail.assignment | |
source folder: | src/main/java |
public static <E> ImmutableList<E> reverse(ImmutableList<E> original)
You will want to build a private static helper method which is tail recursive.
Test
class: | ReverseTestSuite.java | ![]() |
package: | tail.assignment | |
source folder: | src/test/java |