[Solution] Data Routing at Rainforest
Today is the solution of last week’s challenge 👇
Data Routing at Rainforest
Hey, it’s Théo from Forty Two ! Here’s this week’s challenge. Have fun solving it :)
Let us start with the provided data. We know there are initially four cables, which we can label:
a, corresponding to the A-B cable,
b, corresponding to the B-C cable,
c, corresponding to the C-D cable,
d, corresponding to the D-A cable and
e, corresponding to the new B-D cable.
We can now write the following system of linear equations1 representing the information about the cables at our disposal :
Seeing that we have common variables, b and c, in the two equations, we then proceed using the elimination method2.
The difficulty is that, while we have the same coefficients for the variables we’d like to get rid of, we can’t resort to addition straight away, since we do not have opposite signs for them.
Fortunately, much like in rugby, anything goes while the referee isn’t looking. Using the multiplication property of equality, we can rewrite the first equation to multiply both sides by -1, which will have the effect of reversing their signs.
And so we end up with :
We are now ready to add our two equations.
Which we can simplify, canceling out variables :
This tells us the cable labeled d (the D-A cable) is 14ms slower than the cable labeled a (A-B). Going back to the problem, we see the new cable labeled e has a latency of 11ms.
We wanted to understand which was faster, a + e, or d? Knowing that d is slower than a by 14ms, we can see that
Indeed, adding 11ms of latency to the a cable will still be faster than going through the cable which is still 14ms slower than a.
And so we have our answer, going through the new fancy cable, even though it requires an extra step, will be faster by 3ms.
A system of equations are two or more equations used to describe the same system, meaning variables with the same name will have the same value in each of them.
Getting rid of as many variables as possible while combining the equations in order to be able to solve it, at least partially