The following code is an example of a __________ recursive algorithm. int myRecursion(int array[], int first, int last, int val) {     int num;     if (first > last)         return -1;     num = (first + last)/2;     if (array[num] == val)         return num;     if (array[num] < val)         return myRecursion(array, num + 1, last, val);     else

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter6: Arrays
Section: Chapter Questions
Problem 11RQ
icon
Related questions
Question

The following code is an example of a __________ recursive algorithm.
int myRecursion(int array[], int first, int last, int val)
{
    int num;
    if (first > last)
        return -1;
    num = (first + last)/2;
    if (array[num] == val)
        return num;
    if (array[num] < val)
        return myRecursion(array, num + 1, last, val);
    else
        return myRecursion(array, first, num - 1, val);
  }

Question 37 options:

 

a) 

QuickSort

 

b) 

doubly linked list

 

c) 

Towers of Hanoi

 

d) 

binary search

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage