In many Programming Problems, the above mentioned constraint is mentioned. I have seem this in codechef as well as SPOJ.
E.g. Link-1 , Link-2 and many more. (See the section OUTPUT in these two sample links)
What is the meaning of this constraint ? And how can I ensure that this constraint is specified by my output ?
Absolute error is:
|computedAnswer - correctAnswer|
Relative error is:
|(computedAnswer - correctAnswer) / correctAnswer|
Intuitively, absolute error is how far off the computed answer (or approximation) is from the correct (and possibly unknown) answer. Relative error is the ratio of the absolute error to the correct answer.
Thus, whether you are measuring the distance to the moon using a laser ranger or trying to place your left foot correctly during a fox-trot, your absolute error might be half a meter in either case. For the moon distance measurement, that would be pretty good; for the fox-trot, it would get you kicked off Dancing with the Stars.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With