3 ms·
If the number of cases is small and can be completely enumerated, sure. But there are plenty of algorithms out there where the number of cases is effectively i
by colomon 14y ago
If the number of cases is small and can be completely enumerated, sure. But there are plenty of algorithms out there where the number of cases is effectively infinite -- the matrix inversion function someone else mentioned is a great example -- where it is prudent to routinely check results to make sure the algorithm is working. (Mind you, also having a unit test to sure it works on a small set of carefully chosen cases is a great idea.)