随笔分类 - cs61a
伯克利大学的一门基础课
摘要:网址 https://inst.eecs.berkeley.edu/~cs61a/fa21/disc/disc14/ #problem1: 就是两种情况考虑,然后加起来就好了 def paths(x, y): """Return a list of ways to reach y from x by
阅读全文
摘要:网址 https://inst.eecs.berkeley.edu/~cs61a/fa21/lab/lab14/ #problem1: 从上到下,每一次裁剪掉数值大的那个树枝 def prune_min(t): """Prune the tree mutatively. >>> t1 = Tree(
阅读全文
摘要:网址 https://inst.eecs.berkeley.edu/~cs61a/fa21/lab/lab13/ .read data.sql CREATE TABLE bluedog AS SELECT color, pet FROM students WHERE color = 'blue' A
阅读全文
摘要:网址 https://inst.eecs.berkeley.edu/~cs61a/fa21/hw/hw10/ BNF: rstring: "r\"" regex* "\"" ?regex: character | word | group | pipe | class | quants group:
阅读全文
摘要:网址 https://inst.eecs.berkeley.edu/~cs61a/fa21/hw/hw09/#q3-cs-classes problem1:了解正则表达式规则就可以写了 problem2: 第一步匹配[IVXLCDM],第二部不能匹配出现在其他单词里面的用 \b,第三步出现至少一次用
阅读全文
摘要:网址 https://inst.eecs.berkeley.edu/~cs61a/fa21/proj/scheme/#part-i-the-evaluator #problem1: 这一题没什么难度就是注意在lookup函数里面不能用get去找列表里面的值,因为可能值本身就是None def def
阅读全文
摘要:网址 https://inst.eecs.berkeley.edu/~cs61a/fa21/disc/disc10/#wwsd-3 problem1: (define (vir-fib n) (cond ((= n 0) 0) ((= n 1) 1) (else (+ (vir-fib (- n 1
阅读全文
摘要:网址 https://inst.eecs.berkeley.edu/~cs61a/fa21/hw/hw07/#q3-pow problem1: problem2: problem3:
阅读全文
摘要:网址 https://inst.eecs.berkeley.edu/~cs61a/fa21/lab/lab10/ problem1: problem1-6:
阅读全文
摘要:网址 https://inst.eecs.berkeley.edu/~cs61a/fa21/lab/lab08/ problem1: problem2: def convert_link(link): """Takes a linked list and returns a Python list
阅读全文
摘要:网址 https://inst.eecs.berkeley.edu/~cs61a/fa21/disc/disc07/#oop problem1: problem2: problem3: problem4: problem 5: problem6:
阅读全文
摘要:网址 https://inst.eecs.berkeley.edu/~cs61a/fa21/proj/ants/#introduction #problem1: 修改两个ant类的food_cost,并且HarvesterAnt可以每回合加一个gamestate.food class Harvest
阅读全文
摘要:网址 https://inst.eecs.berkeley.edu/~cs61a/fa21/lab/lab07/#topics problem1: case1: case2: case3: Account: class Account: """An account has a balance and
阅读全文
摘要:网址 https://inst.eecs.berkeley.edu/~cs61a/fa21/hw/hw05/#required-questions def gen_perms(seq): """Generates all permutations of the given sequence. Eac
阅读全文
摘要:网址 https://inst.eecs.berkeley.edu/~cs61a/fa20/lab/lab06/#topics problem124: this_file = __file__ def make_adder_inc(a): """ >>> adder1 = make_adder_in
阅读全文
摘要:网址 https://inst.eecs.berkeley.edu/~cs61a/fa21/disc/disc06/#q1-wwpd-mutability problem1: problem2: problem3: problem4: problem5: problem6: problem7:
阅读全文
摘要:网址 https://inst.eecs.berkeley.edu/~cs61a/fa21/lab/lab06/#q5-repeated from re import I HW_SOURCE_FILE = __file__ def insert_items(lst, entry, elem): ""
阅读全文
摘要:网址 https://inst.eecs.berkeley.edu/~cs61a/fa21/hw/hw04/#required-questions problem10的不同原因是精度问题除法在计算机中精确的位数有限,只要数字足够大就会产生不同 代码: HW_SOURCE_FILE = __file_
阅读全文
摘要:网址 https://inst.eecs.berkeley.edu/~cs61a/fa21/disc/disc05/ problem1: problem2: problem3: problem4: problem5: problem6: problem7: problem8: 只有‘1’这个奇数乘三
阅读全文