testing - How do programmers test their algorithm in TopCoder or other competitions? -
good programmers write programs of moderate higher difficulty in competitions of topcoder or acm icpc, have ensure correctness of algorithm before submission.
although provided sample test cases ensure correct output, how guarantees program behave correctly? can write test cases of own won't possible in cases know correct answer through manual calculation. how it?
update: seems, not quite possible analyze , guarantee outcome of algorithm given tight constraints of competitive environment. however, if there manual, more common traits adopted while solving such problems - should enough answer question. best practices..
in competitions, top programmers have enough experience read question, , think of test cases should catch of possibilities input.
it catches of bugs - not 100% safe.
however, in real life critical applications (critical systems on air planes or nuclear reactors example) there methods prove piece of code supposed do.
this field of formal verification - way complex , time consuming done during contest, systems used because mistakes not tolerated.
some additional information:
formal verification consists of 2 parts:
- manual verification - in here use proving systems such hoare logic , manually prove program wants do.
- automatic model checking - modeling problem state machine, , use model checking tools verify module supposed (or not doing "bad").
specifying "what should do" done temporal logic.
this used verify correctness of hardware models well. example intel uses ensure won't floating point bug again.
Comments
Post a Comment