c++
i want to make simple code program of recursion version of (reverse array)
#include <iostream>
using namespace std;
void reverse(int arr[], int i, int j){
if(i<j){
int t = arr[i];
arr[i] = arr[j];
arr[j] = t;
reverse(arr,i+1,j-1);
}
}
int main() {
int arr1[] = {1,2,3,4,5};
cout<<"Origional Array: ";
for(int i = 0;i<5;i++){
cout<<arr1[i]<<" ";
}
cout<<endl;
reverse(arr1, 0, 4);
cout<<"Result Array: ";
for(int i = 0;i<5;i++){
cout<<arr1[i]<<" ";
}
cout<<endl;
cout<<endl;
return 0;
}

c++ i want to make simple code program of recursion version of (reverse array)
Write a program in C to reverse a string using recursion. For example: reverse("abcde", ...) -> "edcba" void reverse(char* str, int i, int s) { } provide output and main please
Write a C Program that inputs an array of integers from the user along-with the length of array. The program then prints out the array of integers in reverse. (You do not need to change (re-assign) the elements in the array, only print the array in reverse.) The program uses a function call with array passed as call by reference. Part of the Program has been given here. You need to complete the Program by writing the function. #include<stdio.h> void...
How do you do reverse arrayList? using recursion? displaying it for example Normal array list 1 2 3 4 5 6 7 reverse array list 7 6 5 4 3 2 1
About Python 3 I want to make calculation data saved as array form So I want code like this i=0 while i<10 x=(mean of 20 random sampled numbers) save x to array A i=i+1 print(A) so I expect A=[x1,x2,x3,x4,x5,...,x10] How can I do this?
Please I need code in C++ Write a program that creates an int array of size 10, then uses a for-loop to populate the array with numbers from your favorite number pattern.
in java Write a program that uses recursion to find the largest number in an array. Declare and initialize an array of 10 different numbers.
I want a python code using recursion ONLY. I cannot use any loops, dictionaries or modules. Only math module is allowed. I want a function that creates a list of the first N prime numbers: for eg create_primes(2) = [2,3] create_primes(5) = [2,3,5,7,11] def create_primes(N): pass
4. (3 points) Consider the following function reverse, that attempts to reverse an array in place (i.e. without the use of additional storage). It does it by interchanging the first and last elements, then the second and second from last etc. All of the interchanges are done by calling function interchange. Here are the two functions and a main program: #include <iostream> using namespace std; void interchange(int x, int y) int temp: temp = x; x=y: y - tempi }...
c++, use the skeleton code to make a program of the
following
include <iostream> tinclude <string> using namespace std; class car public: //define your functions here, at least 5 private: string name; int mpg; double price int horsepower; // feel free to add more atributes int main() // create you objects, call your functions // define member functions here For this lab, write a program that does the following: Creates a class based on the car skeleton code (you may...
use c++ language, keep it simple i am using code block
Exercise #2: Digitise a number Write the function digitiselint, int[]) of type int, which takes an integer N and finds all the digits of that integer and save them in an array. The function then returns the number of digits in N. Write the main() program that reads an integer, calls the function digitisel ), and prints the digits in reverse order. Sample input/output: Enter an integer: 2309456 The...