计算机问题求解一论题2-1 -算法的正确性 2022年2月23日
计算机问题求解 – 论题2-1 - 算法的正确性 2022年2月23日
问题1: 人们似乎对于计算机“犯错比对于人 犯错更加苛刻这是为什么呢?
几种不同的错误 “语言错” 口很容易被语言处理软件发现,甚至自动纠正。 “语义错” 口合格的程序员很少会犯这类错误。 ▣解题逻辑错误 口“粗心”造成的错误。 常见(相对来说) “真正的”逻辑错误。 逻辑错误不常见,但这个是真的“伤脑筋”!
几种不同的错误 ◼ “语言错” ❑ 很容易被语言处理软件发现,甚至自动纠正。 ◼ “语义错” ❑ 合格的程序员很少会犯这类错误。 ◼ 解题逻辑错误 ❑ “粗心”造成的错误。 ◼ 常见(相对来说) ❑ “真正的”逻辑错误。 逻辑错误不常见,但这个是真的“伤脑筋”!
问题2: 书上的对文本中出现“money一词的句子计数的 例子出现了什么样的错误,你能说出它的性质吗?
Test and debugging A designer might try out an algorithm on several typical and atypical inputs and to find the error.In fact,a programmer will normally test a program on numerous inputs,sometimes called test sets,and will gradually rid it of its language errors and most of its logical errors. ■Test是一种合理的获得“正确”程序的方法吗? 口程序是一种人工制品。既然如此,通过实验观察,应该可以得到这个“物体”的某 些属性 0 程序同时又是一种人工“智力”制品,很难通过“实验观察”,洞悉其“正确性” How to“gradually rid it of its errors”? Debug!
Test and debugging ◼ A designer might try out an algorithm on several typical and atypical inputs and to find the error. In fact, a programmer will normally test a program on numerous inputs, sometimes called test sets, and will gradually rid it of its language errors and most of its logical errors. ◼ Test 是一种合理的获得“正确”程序的方法吗? ❑ 程序是一种人工制品。既然如此,通过实验观察,应该可以得到这个“物体”的某 些属性 ❑ 程序同时又是一种人工“智力”制品,很难通过“实验观察”,洞悉其“正确性” ◼ How to “gradually rid it of its errors”? ❑ Debug!