计算机问题求解一论题2-1 ~算法的正确性 2018年3月7日
计算机问题求解 – 论题2-1 - 算法的正确性 2018年3月7日
As discussed in Chapter 1,an algorithmic problem can be concisely divided into two parts: 1.a specification of the set of legal inputs;and 2.the relationship between the inputs and the desired outputs. 这段话和我们今天的主题什么关系?
这段话和我们今天的主题什么关系?
Reverse a string: reverse(“ajjSdt8")=“8td$ja” head(aii$dt8")=“a” and; tail(“ajjSdt8")=“ij$dt8 Also,we use the special symbol"."for string concatenation,or attachment.Thus: “aj$dt8”.“tdd9tr”=“ajjSdta8tdd9tr
Reverse a string:
start 问题: Input:a string of symbol S; X←S: Output:the reverse image of S. Y←-A 算法: 如右图 NO YES X=∧? Y←head(X).Y stop X←-tail(X)
问题: Input: a string of symbol S; Output: the reverse image of S. 算法: 如右图
问题1: 人们似乎对于计算机 “犯错比对于人犯错更 加苛刻,这是为什么呢?