Question: I.)Have two recursive C++ functions with the following prototypes that print the decimal digits of the passed argument forward (most-to least-significant digit) and backward (least-to

I.)Have two recursive C++ functions with the following prototypes that print the decimal digits of the passed argument forward (most-to least-significant digit) and backward (least-to most-significant digit), respectively, with a space after each digit.

Each recursive call should print one digit and space. Leading zeros are not printed.

So I have the functions: void print_long_fwd(unsigned long long val); void print_long_bwd(unsigned long long val);

So my if my input is this: 1234567890

Then both outputs should need to be this,

fwd Output: 1 2 3 4 5 6 7 8 9 0

bwd output: 0 9 8 7 6 5 4 3 2 1

II.) Then need to have a recursive method to find a matching index, if one exists, in array A if not return -1. The algorithm should run in 0(log n), so it would be binary search correct?

III.) Then need a recursive function that return all possible subsets (the power set). Note:

The number of sets is 2n where n is the number of elements in the given set.

The solution set must not contain duplicate subsets.

can use vectors to print the sets with no duplicates.

So one example:

Input: nums = [1,2,3]

Output: [[3], [1], [2], [1,2,3], [1,3], [2,3], [1,2], []]

IV.) Then have a recursive function to multiply two positive integers without using the * operator (or / operator). So can use addition, subtraction, and bit shifting, but I need to minimize the number of those operations. All the functions should run within a test code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!