- 博客(20)
- 收藏
- 关注
原创 Hash_
charAt: 返回一个字符串的一个指定字符:String s = “hello”s.charAt(0)= hwe must first check whether the item we are trying to add is already in that hashcode. If yes, we will do nothing, therefore we have to check all the elements in that linkedList so we just add the
2021-09-28 01:48:41 142
原创 Binary search tree
Tree:nodestwo nodes only be connected by one pathBinary Tree:3. the nodes have only 0,1,2Binary search TreeEvery key in the left subtree is less than X’s key.Every key in the right subtree is greater than X’s key. **Remember this property!! We wil
2021-09-18 06:06:33 149
原创 Asymptotics
Simplfying Algebraic Runtime.pick a cost model(a operation that represent the entire piece of code)focus on the worst cases.ignore small inputs 2N +1 ——> 2Nignore constant scaling factors : 2N -> NOnce we’ve chosen a cost model:we can use in
2021-09-13 13:22:25 145
原创 DisjointSets
indices:索引的意思,相当于indextree数有多高就看有几根线连着的size(weight): the number of items in that tree.
2021-09-12 07:26:14 286
原创 Iteration
Iterationfor(x:y) is an enhanced for loop which can not be applied in a self-designed class. Therefore we need to construct a man-made self-designed iterator method.先用iterator返回一个Iterator的对象,这个对象所对应的interface有enhanced for loop 所需要的方法(hasNext和next)。然后用该对
2021-09-11 14:29:57 443
原创 Recursion
recursion is solving a problem by using simpler version of that problem.1.the simplest posiible input(Base case)2.play around with examples and visualize3.relate hard cases to simpler cases4.generalize the pattern5.write code by combining recursive pa
2021-09-11 08:26:31 68
原创 JUnit
What are the advantages and disadvantages of writing JUnit tests?• Advantages:Keeps your code organized - each test corresponds to different buildingblocks of your programYou can debug your code locally and find which part of your program isnot worki
2021-09-09 08:55:24 65
原创 CS61B Project1A Double Ended Queue
Double Ended Queue(Deque)conceptDeque is a concept and idea not a specific method. The specific methods to construct a double ended queue is by using double linked list and array.CS61B推荐使用双向虚幻列表来完成project1a:即不需要last,只需要一个sentinel即可reference type
2021-09-08 08:41:11 461
原创 Extends
Extendsextends is to inherit one class to the other class. parent classes —>sub classesIf a method was called in another method and the object is from outside of the class, we just called it directly and not add xxx.xxx here.If it is from inside of a
2021-09-08 08:40:50 49
原创 Extends
Extends在一个method里面调用另外一个method,如果这个被调用的method的对象如果是class外部的一个变量,则不用xxx.xxx,如果是class内部的一个变量,则需要xxx.xxx在子构造器被构造时,父构造器会先被调用。eg:public vengefulSLList() { super(); deletedItems = new SLList<Blorp>();这个super表明显性的创造构造器,如果不要super即隐形地创造构造器,因为jav
2021-09-08 08:40:13 68
原创 CS61B Lab 3
CS61B Lab 3红色绿色箭头的debug按钮是default render(渲染器),蓝白框是jh61b render点击之后好,会出现如图的结果这时点击最下方的ArithmaticTest. java:25,可以自动定位到bug的具体位置
2021-08-09 11:39:48 460
原创 CS61B:Inheritance
Inheritence and InterfaceAlist and SLList has the same methods, so we can define the same function but different parameters.For the methods specifying the longest word in a list.public static String longest(SLList<String> list) { int maxDex =
2021-08-09 11:39:25 120
原创 CS61b disc03
Implement SLList.insert which takes in an integer x and an integer position. Itinserts x at the given position. If position is after the end of the list, insert thenew node at the end.For example, if the SLList is 5 → 6 → 2, insert(10, 1) results in ...
2021-08-09 11:38:57 128
原创 Array, AList...
Array,AListtwo elements in Array:fix length of an Array. NA sequence of N memory boxes (N = length) where all boxes are of the same type, and are numbered 0 through N - 1.Three valid notation for array creation:x = new int[3];y = new int[]{1,2,3,4,
2021-08-05 16:19:15 95
原创 CS61B :链表(IntList,SLList....)
链表(IntList,SLList…)If the main method in one java file not exists or incomplete, idea have no optons for run the program.We need two classes, one is the naked recursion IntNode, the other is SLList class to cover the naked one, making it more convenient
2021-08-03 15:14:16 724
原创 Static VS Non-Static
Static VS Non-Staticstatic method:整个class a都可以使用的methodinstance method:一个实例所用的methodstatic variable:整个class 共享的变量 格式:static+变量类型+变量名main classpublic class Item1 { public static void main(String[] args){ Item x = new Item(); Item
2021-08-02 23:17:08 122
原创 Vue常见问题
Vue 所遇到的问题Vscode中vue的注释快捷键(ctril+/)如果template里面包含了多个根元素,则需要将这些根元素用div包含vue文件的component里必须要有有完整的template,template里面需要div,script和style标签。...
2021-08-02 13:50:56 118
原创 Day1:Idea学习
Idea 学习1.2020.3版本以后的idea根本没有import project键!若想导入文件,选择Open操作即可。如何import projectFiles->New-> projects from existing sources->选中所需文件->create project from existing sources->如何找到jdk安装路径 在terminal上输入 java -verbose,最后两行就有jre和jdk的安装路径...
2021-07-30 16:18:22 300
原创 Day1:Git 使用
Git 使用定义1.Git it a distributed version control system2.We call the entire history of an entire project a “repository”语法cmd语法1)、cd : 改变目录。2)、cd . . 回退到上一个目录,直接cd进入默认目录3)、pwd : 显示当前所在的目录路径。4)、ls(ll): 都是列出当前目录中的所有文件,只不过ll(两个ll)列出的内容更为详细。5)、touch
2021-07-30 11:30:46 165
原创 Day1 Markdown 学习
Markdown 学习标题:表示方式:#+ 标题名(#+空格+标题名)#+空格(一级标题)##:二级标题##:三级标题,最多六级字体hello, world!(两个星号是加粗)hello,world(一个星号是斜体)hello,world(三个星号是斜体+下划线)hellow World(两边两个波浪线是删除线)引用选择矿是是是(一个大于符号是引用:引用别的地方的文章与出处)分割线***(是分割线)图片超链接点击百度列表有序空格序号+点+空格A
2021-07-30 10:17:36 107
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人