Task 1

Description: Return minimum number from array

Explanation: Base case: n = 1, in this case we return the first element of the array. Otherwise, we compare two neighbouring elements with recursion and return one that is lesser

Task 2

Description: Return average number from array

Explanation: To find average we need to sum all elements of an array and divide this sum on number of elements and return the value of division

Task 3

Description: Return conclusion on prime number or not

Explanation: Setting a flag for further identifying of prime a number or not, then creating for loop through all numbers from 2 to n/2 with creating if statement to find prime numbers through dividing them on i element in for loop

Task 4

Description: Return factorial of integer n

Explanation: Base case: if n is 0 or 1 then return 1 because 0! = 1 and 1! = 1. Recursive case: if n is greater than 1 - use n * factorial(n - 1)

Task 5

Description: Return n-th element of Fibonacci sequence

Explanation: Base case: if n is 0 or 1 then return n. Recursive case: if n is greater than 1 - calculate the n-th element of Fibonacci sequence with fibonacci(n-1) + fibonacci(n-2)

Task 6

Description: Return a to the power of n

Explanation: Base case: if n is 0 - return 1 because a^0 = 1. Recursive case: if n is greater than 0, calculate a^n as a*a^(n-1)

Task 7

Description: Return reversed array

Explanation: Base case: if there's only one element in the array - print it. Recursive case: print the last element of the array then call the function on the rest of the array

Task 8

Description: Return true if string consists all of digits and false if not

Explanation: Check for base case: if the string is empty - return true, because of the how recursion part works. Check if the first character is a digit. Recursively check the remaining substring. If this character is not digit then the string is not all digits

Task 9

Description: Return binomial coefficient of n and k

Explanation: Base case: C(0, n) = C(n, n) = 1. Recursive case: C(k, n) = C(k-1, n-1) + C(k, n-1)

Task 10

Description: Return GCD

Explanation: Base case: if b = 0 we return 'a' because GCD of 'a' and 0 is 'a'. Recursive case: we keep dividing the larger number by the smaller number until the remainder is zero, core concept - Euclidean Algorithm