(yes) A recursive computation solves a problem by using the solution of the same problem with the simpler inputs.

(no) In all cases the recursive solution is much slower that its iterative counterpart.

Replace the dots ... with the given statement and mark "yes" the cases when the output of the program contains the string "121".

void ret121(int i)

{

...

if (i/10 != 0) ret121(i/10);

}

int main()

{

ret121(122);

return 0;

}

(yes) cout << i;

(no) cout << i%10;

Mark the correct/incorrect assertions about sorting and searching.

(yes) Selection sort is based upon finding the minimum value in a range of indexes and placing that value at the front of the vector.

(no) Merge sort is an O(log n) algorithm.

If it takes 4 seconds to sort 10000 records for both sorts (merge sort is really faster, of course) then

(yes) it will take approx 10 minutes to merge sort 1000000 records.

(no) it will take < 10 hours to selection sort 2000000 records.

Count the number N of the visits of elements required to carry out a search using binary search algorithm. Suppose that we search in the array a:

int a[10] = { 14, 43, 76, 100, 115, 290, 400, 511, 512, 601 };

Mark with "yes" the cases when N is an even number (N mod 2 = 0). We want to know whether the given below number is an element of the array a.

(no) 10

(yes) 43

Count the number of visits of array elements required to carry out a sort using selection sort algorithm. Mark with "yes" the cases when this number is given after the array.

(yes) {5, 8, 7} 7

(no) {5, 7, 8} 7

We have the elements of an array and a number in a parenthesis. Mark with "yes" the cases when the number in the parenthesis is the number of swaps in the selection sort algorithm.

(yes) {1, 2, 4, 5} (0)

(no) {1, 4, 2, 5} (2)

We have the following mutual recursive functions:

int s(int n)

{

if (n != 0) return n + m(n - 1);

else return 1;

}

int m(int n)

{

if (n != 0) return n * s(n - 1);

else return 0;

}

Is the following assertion true?

(no) s(0) is 0

(yes) s(2) is 3

We have the following recursive function:

bool s_is_p(string s, int start, int end)

{

if (start >= end) return true;

f (s[start] == s[end]) return s_is_p(s, start + 2, end - 2);

else return false;

}

Guess the return value when the function is called as follows:

s_is_p(s, 0, s.length() - 1);

The value of a string s is given below.

(true) aaaa

(false) helper

We have a linked list and an iterator:

list<int> bip;

list<int>::iterator it;

The list contains 10 elements and the iterator points to the second element of the list. Mark correct/incorrect (about syntax or logic) expressions:

(yes)*it > 0

(no) *it != *bip.end()