This method returns the value of the minimum element in the subsection of the array "y", starting at position "first" and ending at...
Search Results
Searching for: recursion
Individual Exercises
Write a function in C++ called factorial() that will take a positive integer as input and returns its factorial as output.
Write a recursive function called add_digits that will receive a positive number and returns the sum of each of digits. For example,...
Write a recursive function called half_left that will receive a measurement of the amount of a chemical that is decaying. The amount will...
Write a recursive function called is_increasing that will receive a vector of integers called list and determine whether or not it is...
Description
Recursive procedure that returns the number of H in a string of heads (H) or tails (T) outcomes. This must be a recursive...
Parenthesized notation
A binary tree can be represented in parenthesized notation. The image below shows an example of how to represent...
Parenthesized notation
A binary tree can be represented in parenthesized notation. The image below shows an example of how to represent...
Parenthesized notation
A binary tree can be represented in parenthesized notation. The image below shows an example of how to represent...
Parenthesized notation
A binary tree can be represented in parenthesized notation. The image below shows an example of how to represent...
Parenthesized notation
A binary tree can be represented in parenthesized notation. The image below shows an example of how to represent...
Parenthesized notation
A binary tree can be represented in parenthesized notation. The image below shows an example of how to represent...
Description
Write a recursive method int countDigits(int n) that returns how many digits are in n. The key idea on recursion in this...
Description
Write a recursive method int sumDigits(int n) that returns the sum of all the digits in n. The key idea over recursion in...
Description
Given a string, compute recursively a new string where all spaces in the original one are replaced by an underscore (_).
So...
Description
Given a string, compute recursively a new string where all the adjacent chars are now separated by an underscore ("_"). So...
Given a string, compute recursively a new string where a space is removed and the next letter is converted to uppercase.
So given "Hello...
Given a string, compute recursively a new string where uppercase letters in the original one are preceeded with a space in the new...
Description
Given a string, compute recursively a new string where all vowels in the original string will now be in upper case in the new...
Description
Write a recursive Java method that removes adjacent duplicate characters from a String. If two identical characters appear...
Description
In mathematics, the Pell Numbers follow a familiar recursive structure:
P(n) = 2 * P(n - 1) + P(n - 2) for n > 2
with...