随笔分类 - Java
all about java
摘要:读懂题目后就很简单了!取每个digit用的移位和&15的方法。 public static int[] countingSort(int[] keys, int whichDigit) { // Replace the following line with your solution. int[]
阅读全文
摘要:挣扎了一下,没有想出更好的办法(哈哈哈哈哈哈 public UDGraph length2Paths() { UDGraph newGraph = new UDGraph(vertices); // Put your answer to Part I here. for(int i=0;i<vert
阅读全文
摘要:注意分清楚vert和horiz就好。。。 part one walls的表达方法我是用的 v or h/i/j,最后split一下就可以了,也可以构造一个wall,感觉好像会比较简单。 public Maze(int horizontalSize, int verticalSize) { int i
阅读全文
摘要:part one 网页找不到了。。 part two 前面大致是这个样子的,总体来说quick最快! 作业中有提到 gnuplot,有空再捣腾一下这个东西。 http://www.cnblogs.com/cocowool/archive/2011/07/03/2096924.html(转载) 所以用
阅读全文
摘要:测试结果: part one 对于mergesortQueue这个函数可以最开始用front返回item来比较。。。之前脑筋又短路了。。。搞得有点复杂 public static LinkedQueue mergeSortedQueues(LinkedQueue q1, LinkedQueue q2
阅读全文
摘要:测试结果: private BinaryTreeNode findHelper(Comparable key, BinaryTreeNode node) { // Replace the following line with your solution. BinaryTreeNode moving
阅读全文
摘要:这一次非常自觉的边写边加上了注释hhhhh。为了避免重复代码,写了两个函数。 insertkey():向node插入key encounter3():判断是否node.keys==3(root除外因为root.keys==3这种情况在insert中考虑了),并作出相应的调整。 insert() 结果
阅读全文
摘要:part one parent() part two insertChild() part three removeLeaf() 运行结果:
阅读全文
摘要:。。一直出现nullpointexception 查了半天。。竟然是忘了initialize。。 但是,当我加上注释内容还是出现了exception。。继续查 发现我的makeEmpty是这么写的。。。。。可能最开始理解错了,后来又忘记改了。。 应该这么写 关于数据结构,最开始其实想的是, 然后每次
阅读全文
摘要:直接用的eclipse debug 留个坑 有空整理一下lecture ENCAPSULATED LISTS 一课的内容。
阅读全文
摘要:part one two 提醒注意cast的地方: 这里如果不cast就用不了newNode Comparable cast 注意sentinel的myList也是null 注意有很多地方都要用到InvalidNodeException,就在那个函数处catch就好,不要throw到main不然无法
阅读全文
摘要:part one 在main中加上try/catch(IOException e1){}) 把两个readline包含进去即可 bug是,当withdraw负数时: part two 在findAccount函数中new throws然后每个相关函数都要throws,最后到throw到main后ca
阅读全文
摘要:测试结果: part three 1. 最开始写 LockDListNode extends DListNode 开始报错。分析:class LockDListNode里面没有写构造函数时,java 会自动在superclass里找0参数的构造函数,但是DListNode里面没有0参数的构造函数,报
阅读全文
摘要:其实我不太确定题目是否是这个意思,我就按照我的理解来答题,欢迎来讨论。 part one a b c d 答案都在以下代码中 分析:array的情况和variable情况是一样的,除了代码中array 的cast有点点不一样。。。在compile过程中,array之间相互assign看的是stati
阅读全文
摘要:先上两张结果测试图,这次的project就如作业一开始所说,真的非常time-consuming,要早点做。。。 趴一: 1. 需要特别注意x,y和row,column和i,j和width,height的对应关系,坐标(x,y)中x与width相关代表列,y与height相关代表行。 2. blur
阅读全文
摘要:lab 1 考点: substring/concat/equals/equalsIgnoreCase/indexOf all index from 0 not 1. 完整代码: package lab1; /* Names.java */ import java.io.*; /** The Name
阅读全文

浙公网安备 33010602011771号