摘要:
What is the role of the instance variable sideLength? 从的代码当中我们不难看出,该变量是控制该虫子周围的空间大小的,以提供给变量合理的移动空间。 private int steps; private int sideLength; What is 阅读全文
摘要:
Test the setDirection method with the following inputs and complete the table, giving the compass direction each input represents. Degrees Compass Dir 阅读全文
摘要:
Does the bug always move to a new location? Explain. 不会,虫子真会朝着一个有小格子存在的地方,而且这个格子是空的,或者它上面有一朵红花,只有这个情况它才会移动。 解释:该行为被方法act()限制,所以出现这样的行走方式 In which dire 阅读全文
摘要:
堆排序(不稳定) 堆排序建堆的时候需要在堆的尾部完成,或者就是删除完成重新排列。 堆排序按照我们的需求能够以最大堆和最小堆的方式进行,一般来说: 排序的方案就是按照堆的定义对树不断进行节点的交换。 //java版本的排序方案 public class HeapSort { public void H 阅读全文