CISC365 Lecture 2-5 笔记
Lecture 2: Complexity 如何比较算法 最优性-基于问题 Sorting(排序) vs Packing(装箱/打包) • 优雅性/可解释性-重要但通常不是必须的 • 在需要向用户/非计算机专家提供解释时有用 • 更简洁/更优雅使得以后需要的更改更容易实现 • 通常不是优先事项* 复杂度-用来比较算法的标准,尤其是用大O • 时间复杂度 • 空间复杂度 Efficiency 比较复杂度时使用O, Θ, Ω (Big O, Big Theta, Big Omega)来比较 复杂度从大x大到小排序 渐近复杂度(Asymptotic notations) Best case(最好情况,渐近下界 Ω) 表示:算法在“最好”的情况下,至少需要多少时间/操作数 Worst case(最坏情况,渐近上界 O) 表示:算法在“最坏”的情况下,最多需要多少时间/操作数 Exact order of growth(精确增长阶,紧确界 Θ) 表示:算法的增长速度被上界和下界同时夹住,也就是“总体上就是这个量级”。 Θ 需要对“所有足够大的 n”都同时成立(不能只在偶数或...
COGS201 学习笔记 week 1
Representations 和 Procedures的区别 Representations: 你所知道的 Procedures: 你所在做的 Thinking = Representations + Procedures Representations的例子 Concepts概念 (what is a “chair”? 什么是“椅子”?) Facts事实 (Convocation Hall has a balcony 集会厅设有阳台) Production Rules 规则 (IF the door has a knob, THEN I can turn the knob 如果…那么…) Memories 记忆(读取) (how I felt when I woke up yesterday) Sensations感受 (it’s cold in here) Procedures 的例子 • Logical reasoning逻辑推理 • Solving a problem解决问题 • Making a plan制定计划 • Process...
COGS201 学习笔记 week 2
查询 123?- parent(anakin,Who).Who = lukeWho = leia 一个查询可能有多个正确答案 返回false表示没有找到 Conditional Sentences 条件语句 组成: Consequent 结论 Implication 蕴含关系 Antecedent 前提 1mother(X,Y) :- parent(X,Y), female(X). 若X是Y的父母且X为女性,则X是Y的母亲。 逗号表示‘’和’ 12father(X,Y) :- parent(X,Y), male(X).grandparent(X,Y) :- parent(X,Z), parent(Z,Y) “若X是某个Z的父母,且Z是Y的父母,则X是Y的祖父母。” Negation 否定 Prolog 中的“非”符号是 \+ 例: 1?- parent(X,luke), \+ female(X). 找到luke的父母中不是女性的那位 Equality 相等 Prolog 支持等式: X=Y,但通常不需要单独写 X=Y 而是直接用同一个变量名 写法 A(用等式把两个变量连起来) ...
Hello World
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub. Quick Start Create a new post 1$ hexo new "My New Post" More info: Writing Run server 1$ hexo server More info: Server Generate static files 1$ hexo generate More info: Generating Deploy to remote sites 1$ hexo deploy More info: Deployment