When the index is known, what is the time complexity for accessing an element in an array list?
Recursion and Big O Exercises
Score: 0 / 10.0
Exercises
What is the complexity of searching an ArrayList?
Given an array of int
s, compute recursively the number of times that the value 11 appears in the array (no loops). We'll use the...
Given a non-negative int n
, compute recursively (no loops) the count of the occurrences of 8 as a digit, except that an 8 with another 8...
Given a non-negative int n
, return the sum of its digits recursively (no loops). Note that mod (%
) by 10 yields the rightmost digit (126...
Given a string, compute recursively a new string where all the adjacent chars are now separated by a "*". So given "hello", return...
Given a string, compute the number of times lowercase "hi" appears in the string. Make the countHi
be recursive.
Given a string that contains a single pair of parenthesis, compute recursively a new string containing only the parentheses and their...
Count recursively (no loops) the total number of "abc" and "aba" substrings that appear in the given string.
Given a string, compute recursively (no loops) a new string where all the lowercase 'x' chars have been changed to 'y' chars.