/avatar.jpg

Lec27-Scheme Lists

Scheme Lists cons / car / cdr / nil 1 2 3 4 (null? nil) ; #t (null? (cons 1 nil)) ; #f (car (cons 1 2)) ; 1 (list 1 2 3) ; (1 2 3) Symbolic Programming Lisp is a symbolic programming language, which uses in AI for a long time…? 注意单引号 1 (car (cdr (car (cdr '(1 (2 3) 4))))) ; 3 List Processing 纯看scheme属实有点抽象了 helper function 化简之

Lec23-Eifficiency

Efficiency Memorization Idea: Memorize a large set of information and use it to quickly recall it. fib 1 2 3 4 5 6 7 8 def memo(f): cache = {} def memoized(n): if n not in cache: cache[n] = f(n) return cache[n] return memoized Exponentiation 前者 O(N) ,后者 O(logN) 省流 CS61B前瞻,对时间复杂度和空间复杂度初步探索

Lec24-Decomposition

Decomposition Modular Design dddd 有趣的语法 1 2 3 4 5 6 7 ... # 用于省略代码 import json for i in open('data.json'): data = json.loads(i) # 处理数据...