Share
Explore BrainMass

C++

C++. See attached file for full problem description.

Attachments

Solution Preview

The answers are written in the attached Word file which is a copy of your file with answers added in red using "Track Changes"

Here is the pasting:
================
Question 41
In the backtracking algorithm, if it is determined that a partial solution would end in a dead end, then the algorithm ____.

terminates

restarts
V
removes the most recently added part and tries other possibilities

was designed incorrectly

Question 42

void decToBin(int num, int base)
{
if(num > 0)
{
decToBin(num/base, base);
cout<<num % base;
}
}

Note that inside the recursion decToBin is executed before the cout << ...
, therefore the last digit is printed out last

Given the recursive function above, what is the result of decToBin(39, 2)?

10111

10011
V
100111

110111

Question 43

int func1(int m, int n) {
if ...

$2.19