Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Goal: Learn how to use recursive functions. General requirement: Use cout to fully demonstrate your works. The output must clearly show how each of
Goal: Learn how to use recursive functions. General requirement: Use cout to fully demonstrate your works. The output must clearly show how each of these tasks work. If no output is displayed for a task below, 0 point will be given to the task. If the output is not clear, some points may be deducted. Task 1 - Reverse array (5 pts) Given an integer array like: const int SIZE =9; int arrint[SIZE]=(1,2,3,4,5,6,7,8,9): Use a recursive function to reverse the array. Task 2 - Array sum: for loop verslon (5 pts) Use a for loop to add the integers of the array in Task 1 and display the sum. Task 3 - Array sum: Linear recursive version (5 pts) Use a linear recursive function to add the integers of the array in Task 1 and display the sum. Task 4 - Array sum: Binary recursive version (5 pts) Use a binary recursive function to add the integers of the array in Task 1 and display the sum. Write recursive function in c++ of following functions 1. Write a recursive function int binarySearch(int[] a, int start, int end, int x) that uses the binary search algorithm to check whether the sorted array a contains the element x anywhere between indices start and end, inclusive. Function should return index of element 'x' if it exists in the array and return -1 otherwise. 2. Write a recursive function of MergeSort to sort an array in ascending order 3. Write a recursive function Sum that takes a two-dimensional array and returns sum of its all elements.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started