您的位置:首页 > 其它

《算法导论》第一章~第五章 要点笔记

2010-11-29 10:46 218 查看
short circuiting
The boolean operators "and" and "or" are short circuiting. That is, when we evaluate the expression "x and y" we first evaluate x. If x evaluates to FALSE, then the entire expression cannot evaluate to TRUE, and so we do not evaluate y. If, on the other hand, x evaluates to TRUE, we must evaluate y to determine the value of the entire expression.

Short-circuiting operators allow us to write boolean expressions such as "x ≠ NIL and f[x] = y" without worrying about what happens when we try to evaluate f[x] when x is NIL.


random-access machine (RAM)
random-access machine (RAM) model of computation as our implementation technology and understand that our algorithms will be implemented as computer programs. In the RAM model, instructions are executed one after another, with no concurrent operations. In later chapters, however, we shall have occasion to investigate models for digital hardware.


循环
while(){}的()比{}多一步。
循环中,while语句的的()判断要比{}执行多走一步。For(){}循环同理。


时间复杂度
“It is the rate of growth, or order of growth, of the running time that really interests us.”
也就是说,时间复杂度其实度量的对象是时间增长规模

关于 upper bound and lower bound,书中有图:



类比:时间复杂度与比较关系

f(n) = O(g(n))

a ≤ b,
f(n) = Ω(g(n))

a ≥ b,
f(n) = Θ(g(n))

a = b,
f(n) = o(g(n))

a < b,
f(n) = ω(g(n))

a > b.
几个翻译
uniform random permutation 均匀随机排列
indicator random variables 示性随机变量


两人同一天出生的概率
More intuitively, once bi is chosen, the probability that bj is chosen to be the same day is 1/n. Thus, the probability that i and j have the same birthday is the same as the probability that the birthday of one of them falls on a given day.


文氏图表达的集合运算










Cartesian product笛卡尔积的定义
The Cartesian product of two sets A and B, denoted A × B, is the set of all ordered pairs such that the first element of the pair is an element of A and the second is an element of B. More formally,
A × B = {(a b) : a ∈ A and b ∈ B}.
For example, {a, b}×{a, b, c} = {(a, a), (a, b), (a, c), (b, a), (b, b), (b, c)}. When A and B are finite sets, the cardinality of their Cartesian product is |A×B|=|A|×|B|
The Cartesian product of n sets A1, A2,..., An is the set of n-tuples(n元组)
A1 × A2 × ··· × An = {(a1, a2,..., an) : ai ∈ Ai, i = 1, 2,..., n},
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: