|
1 Objective Questions |
|
2 ------------------- |
|
3 |
|
4 .. A mininum of 8 questions here (along with answers) |
|
5 |
|
6 |
|
7 Larger Questions |
|
8 ---------------- |
|
9 |
|
10 .. A minimum of 2 questions here (along with answers) |
|
11 |
|
12 1. Consider an array [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]. A fold and add |
|
13 operation consist of two phases, a right fold and add and a left |
|
14 fold and add. |
|
15 |
|
16 Say in first fold and add, we take the right fold of the array and |
|
17 add it to the left like, |
|
18 |
|
19 [1+10, 2+9, 3+8, 4+7, 5+6, 6, 7, 8, 9, 10] |
|
20 |
|
21 and it becomes |
|
22 |
|
23 [11, 11, 11, 11, 11, 6, 7, 8, 9, 10] |
|
24 |
|
25 and in the second fold and add, we take the left fold of the new |
|
26 array and add it to the right and it becomes, |
|
27 |
|
28 [11, 11, 11, 11, 11, 17, 18, 19, 20, 21]. |
|
29 |
|
30 What will be the array after 22 such operations starting with [1, |
|
31 2, 3, 4, 5, 6, 7, 8, 9, 10] |
|
32 |