Answered step by step
Verified Expert Solution
Link Copied!

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

 

imageimage

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Organizational Behaviour Concepts Controversies Applications

Authors: Nancy Langton, Stephen P. Robbins, Timothy A. Judge, Katherine Breward

6th Canadian Edition

132310317, 978-0132310314

More Books

Students also viewed these Computer Network questions