Quiz: Recursion

Let’s attempt the quiz to test what we’ve learned so far about recusion.

Questions

Given an array of integers in increasing order, find if avalue is present in the array using recursion.

Input

An integer array and an integer number.

Output

Return true if integer found. Otherwise, return false.

Sample input

array = { 1, 3, 4, 6, 8, 10 }
num = 3

Sample output

True

This will be done in O(log(n))O(log(n)).

Let’s look at the illustration below to better understand the problem.

Get hands-on with 1400+ tech skills courses.