- 博客(11)
- 收藏
- 关注
原创 前端学习笔记-BBC网站复刻
刚开始学习前端,学了HTML和CSS之后,自己照着BBC网站用学到的知识把整个网站复刻下来,仅仅只是把网站的模样复制过来,还没有交互的内容,继续学JS希望可以做出更好看的网站。CSS学习过程中一开始对margin, border, padding难以区分,后来借鉴了w3school上的图,一目了然。在加入同一类别的文字或图像,最好使用class标签,以便于统一对文字或图像进行修改。养成良好的编程习...
2018-05-10 15:19:13
961
1
原创 CS61B Homework9作业回顾(附代码)
本次作业主要学会运用Disjoin Sets,DisjointSets的class作业已经写好给出。class中两个重要的方法是find和union,find(x)方法返回x的root,并在搜寻过程中递归使用path compression,使得路径上的每个node直接指向root。Union(root1,root2)方法将两个set的root指向其中等级高的那个,else使root1成为新的ro...
2018-04-08 11:06:36
419
原创 CS61B Homework8 作业回顾(附代码)
一开始在mergeSortedQueues()中想到的是用nth()方法通过count i和j来对比q1和q2中值的大小,也能做出来。后面开始计时之后发现这个方法特别慢,因为每调用一次nth(n)方法,他都要进行n次循环,大大增加了计算次数。后来就干脆用front()得到的值进行对比,再用dequeue()和enqueue()方法。Linkedlist有remove first node的操作,但...
2018-03-31 16:15:48
367
原创 CS61B Homework7作业回顾 (附代码)
发现编程真的是很强调逻辑。首先Track down the whole tree, split 3-key node into 2 node, move the middle element to the parent node. If the parent node is null, then creat a new one. 然后针对node上keys 的数量进行分类讨论,同时设置positi...
2018-03-28 12:16:35
391
原创 CS61B Homework6作业回顾(附代码)
本次作业重点是hascode和compress function,评价一个compress function好坏的标准是能否实现keys在buckets中的随机分布作业要求Load Factor(=keys/buckets)在0.5-1之间,我记得书上说0.75比较好,然后就直接让buckets的length用size除以0.75:length=(int)(getPrime(sizeEstimat...
2018-03-26 10:42:48
704
原创 AVL Tree 平衡二叉树 Java实现
先介绍一个概念:Height balance property: For every internal node v of T, the height of the children of v differs by 1 at most. 每个子结点的高度差最多为1.符合Height balance property的BST叫做AVL Tree,平衡二叉树。对于一个有n个节点的平衡二叉树来说,它的高...
2018-03-18 16:37:50
399
原创 Binary Search Tree二叉搜索树 Java实现
insert()方法。这是我一开始听完课之后想到的insert方法,是错的。因为current为null的时候,用newNode替代current,但是此时的current已经是null,和原来的节点不存在子节点的关系。public void insert(int key){ Node newNode = new Node(key); if (root == nul...
2018-03-17 10:46:32
230
原创 Heap Sort堆排序 Java语言实现
A binary heap is a complete binary tree which stores the following property:1: It's a complete tree. Every row is full, except the bottom row.2. A binary heap is either a MaxHeap( the key in a parent ...
2018-03-16 14:36:28
178
原创 CS61BHomework3作业回顾(附代码)
Part 1.smoosh()函数,目的是将数组中出现的所有数字产生重复的部分删除,例如11223334444经过smoosh函数后会变成1234. public static void smoosh(int[] ints) { // Fill in your solution here. (Ours is twelve lines long, not counting ...
2018-03-07 20:53:39
911
原创 CS61B Homework5作业回顾(附代码)
HW5一开始做不出来的同学可以继续先看Lecture,Encapsulated List那一节老师会回顾一下HW5,对作业有启发思路的作用。Part1.HW5的DListNode增加一个myList的field,用于确认node位于哪个list,同时也为后面的isValidNode()服务。remove()之后需要将myList, prev, next 统统指向null,不然这个node的prev...
2018-03-07 11:13:04
1750
原创 CS61B Homework4作业回顾(附代码)
这次作业没有测试代码,一亩地上有测试数据链接:http://pan.baidu.com/s/1dD5ql4PDList中的insertFront, insetBack等方法多为视频前几节讲的Doubly-Linkedlist.在测试TestLockDList的时候总是出现ClassCastException, 然而我LockDList中的代码都没写错,也override newNode。后来发现在...
2018-03-03 11:38:57
636
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人