There is a bag containing two coins: one double-headed and one coin which is weighted such...
Palo Alto Networks technical mcq question, verified with a worked answer. Free to practise - no sign-up.
There is a bag containing two coins: one double-headed and one coin which is weighted such that the probability of getting heads when it is flipped is 75%. A coin is taken at random from the bag and flipped. If it lands heads, what is the probability that the coin is double-headed?
Round your answer to the nearest percentage.
Select any one of the following
Show answer & explanation
Using a comparator/balance scale between sets of laddus divides the search space into 3 parts at each step, taking ceil(log_3(n)) = O(log n) comparisons in the worst case.
Step-by-step Derivation:
Step 1: A two-pan balance scale gives 3 possible outcomes: left lighter, right lighter, or both equal.
Step 2: By dividing n laddus into 3 equal sets (or n/3), each comparison reduces candidate size by a factor of 3.
Step 3: The minimum number of comparisons needed to find the defective laddu in the worst case is ceil(log_3(n)) = O(log n).