How can a recursive function be used to calculate a Fibonacci
number? - <<<<ANSWERS>>>By calling itself with the two
previous numbers in the sequence until reaching the base cases
Which function is a recurrence relation? - <<<<ANSWERS>>>f(n)
= f(n-1) + 2
How many levels will a recursion tree have if the recursive
function's runtime is T(N) = N + T(N - 8)? -
<<<<ANSWERS>>>N/8
Read the example of code for a function that builds and returns a
list of odd numbers from the input list:
def get_odd_numbers(input_list):
odd_numbers = []
for number in input_list:
if number % 2 != 0:
odd_numbers.append(number)
return odd_numbers
, What is the worst-case auxiliary space complexity of
get_odd_numbers() if N is the length of the input list? -
<<<<ANSWERS>>>O(N)
Which sort algorithm requires that the range of the values be input
before the sort starts? - <<<<ANSWERS>>>Counting
Which arithmetic example correctly follows the precedence rules?
- <<<<ANSWERS>>>*,-
Which operation is completed first in this statement?
X/2+Y**2 == 10 - <<<<ANSWERS>>>Y**2
Which of these Big O notations is equivalent to O(855 * N)? -
<<<<ANSWERS>>>O(N)
What is the simplified Big O notation for the expression O(12N +
7N + 500)? - <<<<ANSWERS>>>O(N)
Which Big O notation represents a linearithmic runtime
complexity? - <<<<ANSWERS>>>O(N log N)
Read the code example that checks if a number is present in a
list:
def contains_number(input_list, key):
for number in input_list:
if number == key:
return True
return False
Which approach denotes a top-down process for designing an
algorithm? - <<<<ANSWERS>>>Divide-and-conquer approach
number? - <<<<ANSWERS>>>By calling itself with the two
previous numbers in the sequence until reaching the base cases
Which function is a recurrence relation? - <<<<ANSWERS>>>f(n)
= f(n-1) + 2
How many levels will a recursion tree have if the recursive
function's runtime is T(N) = N + T(N - 8)? -
<<<<ANSWERS>>>N/8
Read the example of code for a function that builds and returns a
list of odd numbers from the input list:
def get_odd_numbers(input_list):
odd_numbers = []
for number in input_list:
if number % 2 != 0:
odd_numbers.append(number)
return odd_numbers
, What is the worst-case auxiliary space complexity of
get_odd_numbers() if N is the length of the input list? -
<<<<ANSWERS>>>O(N)
Which sort algorithm requires that the range of the values be input
before the sort starts? - <<<<ANSWERS>>>Counting
Which arithmetic example correctly follows the precedence rules?
- <<<<ANSWERS>>>*,-
Which operation is completed first in this statement?
X/2+Y**2 == 10 - <<<<ANSWERS>>>Y**2
Which of these Big O notations is equivalent to O(855 * N)? -
<<<<ANSWERS>>>O(N)
What is the simplified Big O notation for the expression O(12N +
7N + 500)? - <<<<ANSWERS>>>O(N)
Which Big O notation represents a linearithmic runtime
complexity? - <<<<ANSWERS>>>O(N log N)
Read the code example that checks if a number is present in a
list:
def contains_number(input_list, key):
for number in input_list:
if number == key:
return True
return False
Which approach denotes a top-down process for designing an
algorithm? - <<<<ANSWERS>>>Divide-and-conquer approach