TCS
Company
1. Alok and Bhanu play the following game on arithmetic expressions. Given the
expression
N = (Θ + A)/B + (Θ + C + D)/E
where A, B, C, D and E are variables representing digits (0 to 9), Alok would like to
maximize N while Bhanu would like to minimize it. Towards this end, they take turns in
instantiating the variables. Alok starts and, at each move, proposes a value (digit 0-9)
and Bhanu substitutes the value for a variable of her choice. Assuming both play to their
optimal strategies, what is the value of N at the end of the game? Also find a sequence
of moves (digits by Alok and variables by Bhanu) that would yield this value.
Note: Moves that lead to a divide-by-zero condition are disallowed. A non-optimal
sequence of moves is (5 → B, 6 → C , 3 → D, 2 → E, 0 → A) and the expression
evaluates to Θ/5 + (Θ+9)/2.
2. The mean, unique mode, median and range of 21 positive integers is 21. What is the
largest value that can be in this sequence? Also find such a sequence.
Note: Given a sequence of numbers a(1) ≤ a(2) ≤ ... ≤ a(n),
The median of the sequence is the middlemost value in the sequence if n is
odd and the average of the two middle values if n is even.
The mode is the most occurring value in the sequence
The range is the difference between the largest and the smallest values, i.e.
a(n) - a(1).
For example, the sequence 2, 3, 4, 6, 6, 9 has mean = (2 + 3 + 4 + 6 + 6 + 9)/6 = 5,
median = (4+6)/2 =5, mode = 6, and range = 9 – 2 = 7.
Read Solution (Total 2)
-
- 21 is contained in the list, since it is the unique mode. Thus, we can't have the largest element be greater than 42, because then the range would be larger than 42-21=21.
So, we try to find a set with 42 as the largest element. If 42 is the largest element, then 21 is the smallest element (to keep the range at 21). We calculate the smallest possible mean: twenty 21s and one 42. The mean of this set is 22. Thus, even if we take the smallest possible set, the mean is still too big.
So, the largest element must be less than 42. So we try to find a set that has 41 as its largest element. If 41 is the largest element, then 20 must be the smallest, to keep the range at 21. Again, we calculate the smallest possible mean:
If we had eleven or more 20s in our list, then 20 would be the median, which isn't the case. If we had ten 20s, ten 21s, and 41, then 21 would not be the unique mode. Thus, the smallest possible mean is given by nine 20s, eleven 21s, and 41, in which case the mean is 21.52, so this can't happen.
So now we try to find a set with the largest element 40.
And it turns out there is such a set:
nine 19s, one 20, ten 21s, and 40
the mean, median, range, and unique mode is 21 - 7 years agoHelpfull: Yes(9) No(0)
- plzz post solution for tz qn
- 12 years agoHelpfull: Yes(0) No(13)
TCS Other Question