摘要: 读懂题目后就很简单了!取每个digit用的移位和&15的方法。 public static int[] countingSort(int[] keys, int whichDigit) { // Replace the following line with your solution. int[] 阅读全文
posted @ 2017-08-18 11:16 切力 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 挣扎了一下,没有想出更好的办法(哈哈哈哈哈哈 public UDGraph length2Paths() { UDGraph newGraph = new UDGraph(vertices); // Put your answer to Part I here. for(int i=0;i<vert 阅读全文
posted @ 2017-08-16 21:35 切力 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 注意分清楚vert和horiz就好。。。 part one walls的表达方法我是用的 v or h/i/j,最后split一下就可以了,也可以构造一个wall,感觉好像会比较简单。 public Maze(int horizontalSize, int verticalSize) { int i 阅读全文
posted @ 2017-08-14 14:42 切力 阅读(108) 评论(0) 推荐(0) 编辑
摘要: part one 网页找不到了。。 part two 前面大致是这个样子的,总体来说quick最快! 作业中有提到 gnuplot,有空再捣腾一下这个东西。 http://www.cnblogs.com/cocowool/archive/2011/07/03/2096924.html(转载) 所以用 阅读全文
posted @ 2017-08-09 16:59 切力 阅读(256) 评论(0) 推荐(0) 编辑
摘要: 测试结果: part one 对于mergesortQueue这个函数可以最开始用front返回item来比较。。。之前脑筋又短路了。。。搞得有点复杂 public static LinkedQueue mergeSortedQueues(LinkedQueue q1, LinkedQueue q2 阅读全文
posted @ 2017-08-08 23:29 切力 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 测试结果: private BinaryTreeNode findHelper(Comparable key, BinaryTreeNode node) { // Replace the following line with your solution. BinaryTreeNode moving 阅读全文
posted @ 2017-08-04 17:28 切力 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 这一次非常自觉的边写边加上了注释hhhhh。为了避免重复代码,写了两个函数。 insertkey():向node插入key encounter3():判断是否node.keys==3(root除外因为root.keys==3这种情况在insert中考虑了),并作出相应的调整。 insert() 结果 阅读全文
posted @ 2017-08-03 21:57 切力 阅读(156) 评论(0) 推荐(0) 编辑
摘要: part one parent() part two insertChild() part three removeLeaf() 运行结果: 阅读全文
posted @ 2017-08-01 18:41 切力 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 。。一直出现nullpointexception 查了半天。。竟然是忘了initialize。。 但是,当我加上注释内容还是出现了exception。。继续查 发现我的makeEmpty是这么写的。。。。。可能最开始理解错了,后来又忘记改了。。 应该这么写 关于数据结构,最开始其实想的是, 然后每次 阅读全文
posted @ 2017-07-31 11:29 切力 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 直接用的eclipse debug 留个坑 有空整理一下lecture ENCAPSULATED LISTS 一课的内容。 阅读全文
posted @ 2017-07-28 16:02 切力 阅读(128) 评论(0) 推荐(0) 编辑