• recategorized by
1,244 views
1 1 vote
Consider a standard balance with two pans where weights can only be placed on the left pan, and the object to be weighed on the right pan. Find the minimum number of weights required to weigh any object whose weight in grams could be any integer ranging from $1$ to $127 .$ Give precise argument in favor of your answer.

1 Answer

2 2 votes
The question is pretty straightforward.
We reduce the problem to "represent any decimal number from 1 to 127 in form of binary number but how many bits do we need to do that?"
That is, ceil(lg 127)=7

Thus, we need, 1, 2, 4, 8, 16, 32, and 64 gram weights
so 7 weights in total we need to represent any number from 1 to 127
Position:
Show:

Related questions

1 1 vote
2 2 answers
893
893 views
admin asked Aug 8, 2022
893 views
Consider the single precision (i.e., $32$-bit) floating point representation of numbers in the normalized form where $8$ bits are used for the exponent with the bias of $...
1 1 vote
2 2 answers
937
937 views
admin asked Aug 8, 2022
937 views
Given a set $S$ of $n$ integers and a constant $k$ (positive integer), design an algorithm for finding a subset of $S$ of maximum possible size such that the sum of each ...
1 1 vote
2 2 answers
1.7k
1.7k views
admin asked Aug 24, 2022
1,691 views
Consider a $4$-way set associative cache mapping, in which the cache blocks are grouped into sets and each set has $4$ blocks. There are $16$ cache blocks in total. The f...
0 0 votes
2 2 answers
964
964 views
admin asked Aug 8, 2022
964 views
Let $P$ be a set of $n$ real numbers. For any two real numbers $a$ and $b$ $(a<b),$ define $$ R(a, b)=|\{x \in P \mid a \leq x \leq b\}| . $$Design a suitable data struct...