πŸ“œ ⬆️ ⬇️

On the non-trivial seduction of the tester Claudia: puzzles from the GridGain booklet with JBreak and JPoint

The next JBreak and JPoint Java conferences were held with a bang. Local reports always have a resonance, but many people still remember something else.

Booklet GridGain. Tasks about Gref and Balmer, a Belarusian programmer with a bucket of potatoes and, of course, the non-trivial seduction of the tester Claudia continues to publish on various resources to the joy of the author, and many no longer even know what their source is.


We tell. The problems were specially written by the chief architect of the core-team GridGain Sergey Vladykin and then solved by all the other participants.
')
We know that the majority of conference attendees, the main difficulty was caused by the task number 1. Do not worry, it was the same among the GridGain employees! But, in fairness, it should be noted that at the Moscow JPoint there were 3 people who decided correctly all 4 tasks and passed on their results to us.

A country! Know your heroes! It:


Today we publish solutions to the problems: for those who remember them well, and for those who see them for the first time. Have fun!



Decision
It seems to us that the participants had two main, at first glance, conflicting statements: on the one hand, German Oskarovich and Steve agreed to transfer bytes in turn, on the other - they can speak and listen at the same time. The subtlety is that if each of the participants can distinguish a word from silence in 0.05 seconds, then the last bit in a byte can be distinguished in 0.05 seconds (even if it was a word encoding β€œ1”) and start transmitting the next byte in the other direction. Therefore, the transmission time of the first seven bits in a byte depends on the value of the byte, and the last bit can always be transmitted in 0.05 seconds.

Then it remains only to calculate the average transmission time of one byte in each direction. Since the values ​​of bits β€œ1” and β€œ0” are equally probable, the transmission time of one byte in one direction is

1 over2(1 over7+1 over20) times7+1 over20


seconds, the transfer time of one byte to the other side is

1 over2(1 over11+1 over20) times7+1 over20


seconds The total transmission time of two bytes in both directions is

1 over2(1 over7+1 over11+1 over10) times7+1 over10


seconds, and, accordingly, the bandwidth in bits is

16 over1 over2(1 over7+1 over11+1 over10) times7+1 over10 approx12.62 textbps.



It is also worth noting that it is incorrect to carry out similar calculations with frequencies, since frequency averaging violates the assumption of a uniform distribution of β€œ1” and β€œ0” in bits.




Decision
It is clear that both drug addicts are involved in the transfer of the syringe, so only the first and third steps can be performed in parallel, and the time of this parallel execution will be equal to the maximum of T1 and T3, while in transferring the syringe neither the first nor the second addict can perform other actions That is, the transfer of the syringe will be performed sequentially with other steps. Therefore, the answer is:

 max(T1,T3)+T2






Decision
In this task, we need to optimize the average number of potatoes that fall into a bucket per unit of time, which is equal to the product of the quantity of potatoes harvested per unit of time by the probability that this potato falls into the bucket. If x is the programmer's distance from the bucket, then the average number of potatoes is calculated by the formula

V(x)=(0.5+x)(1βˆ’0.25x)=βˆ’0.25x2+0.875x+0.5


The quadratic function reaches its extremum (in this case, the maximum) at the point

$$ display $$ - {b \ over2a} = {0.875 \ over2 \ times0.25} = 1.75 $$ display $$





Decision
Innocent will meet Kondratiy in the hayloft if in 90 minutes of testing Claudia does not reproduce the bug, and during the test run of the tests, the QA-lead will still detect it. It is clear that each of the tests is independent of the other, so the final probability will be equal to the product of the probabilities of each of the events. Since the pick-up line is displayed at the end of the test run, we are only interested in the number of complete test runs in 90 minutes, which is equal to

 textfloor(90 over17)=5


The probability that a bug will not be reproduced in 5 runs of tests is

(1βˆ’0.11)5


so the probability that after 5 successful test runs the bug is reproduced in the control run is equal to

(1βˆ’0.11)5 times0.11=0.0614



PS Thanks for the efforts of all those who found time at the conferences of JPoint and JBreak to solve these problems. And there were many of them that can not but rejoice!

Source: https://habr.com/ru/post/327732/


All Articles