In programming languages, recursion happens when a method calls itself
Algorithm: binarySearch(dictionary, word)
How many ways are there to choose k out of n items (e.g., 3 out of 5 items)?
Write a recursive method that determines if a string represents a non-negative integer. Assume '+' has been stripped off (if necessary).
A string is a non-negative integer if
Write a recursive method that determines if a chain of linked nodes containing integers is strictly increasing.
Write a recursive method that determines if string is a palindrome.
Examples of palindromes:
Assume: input string is not null, has been stripped of all spaces and punctuation, and is in all lower-case
Useful string methods:
Write a recursive method that counts the number of even values in a chain of linked nodes containing integer values.
First complete the English description for the base cases and recursive case:
Then complete the recursive countEven method:
public static int countEven(Listnode<Integer> head) {
Step 1: write recurrence relations
T(0) = _____
T(N) = _____ + _____ × T( _____ )
Step 2: guess a solution
Step 3: verify solution
Step 4: apply big-O notation to guessed solution