标签:编写 eth iat 连接 AC 照片 需要 存储 代码行数
集合分同构和异构
同构:集合中保存的类型全部相同。
异构:集合中可以保存全部的类型。
线性数据结构
- 堆栈:堆栈是一种以后进先出方式管理数据的线性数据结构。
但是它就是显示有错,然后我决定先不变加入对象的方法,等对象全部加进去了,在用一个方法进行排序,于是改编了之前写的一个向链表里插入的方法,可以把对象与其他进行比较,再插入到顺序位置,像这样
这样子已经可以实现了,但是再编写这个方法的时候,我发现之前报错的原因好像就是我进行比较的类型不对,于是我又想办法让在向链表里添加对象时就完成排序
很可惜还是失败了。
The following method should return true if the int parameter is even and either positive or 0, and false otherwise. Which set of code should you use to replace ... so that the method works appropriately?
public boolean question3(int x) { ... }
A . if (x = = 0) return true;else if (x < 0) return false;else return question3(x - 1);
B . if (x = = 0) return false;else if (x < 0) return true;else return question3(x - 1);
C . if (x = = 0) return true;else if (x < 0) return false;else return question3(x - 2);
D . if (x = = 0) return false;else if (x < 0) return true;else return question3(x - 2);
E . return(x = = 0);
正确答案: C 你的答案: A
我当时想了好一会,本来想自己在idea上实验一下的,但是感觉时间不够了,就没有试,结果想错了。
该方法会递归地让自己从X-2,直到X=0或X<0。如果X=0,那么它X-2i==0或X=2i,所以X必须是偶数。否则,递归在X<0时结束,也就是说,原来的X是奇数或小于0
An infinite loop and an infinite recursion
A . are different because it is impossible to detect the latter, while it‘s quite easy to detect the former
B . both continue to repeat indefinitely
C . both will be caught by the compiler
D . both will be caught by the Java Virtual Machine during execution
E . none of the above
正确答案: B 你的答案: C
我当时依稀记得在哪里看到了他们两个应该是有些区别的,但是没有仔细去回想,就选了一个C
无限循环和递归都是相似的,因为它们会无限地重复。既不能被编译器捕获,也不能被运行时捕获。
We can define a list of int values recursively as: a list_item, followed by a comma, followed by a list where a list_item is any int value.
A . true
B . false
正确答案: B 你的答案: A
当时没觉得哪里不对,唉,太年轻。
递归定义不包含一个基例,使得INT值的所有列表都将无限长
The following method correctly adds two ints, returning their sum:
public int add(int a, int b)
{
return (b > 0) ? add(a+1, b-1) : a;
}
A . true
B . false
正确答案: B 你的答案: A
我当时没有考虑周全,下意识地感觉是对的
对于大于或等于零的INT,该加法方法是可以完成得;但如果B小于0,则该方法就会失败。
代码行数(新增/累积) | 博客量(新增/累积) | 学习时间(新增/累积) | 重要成长 | |
---|---|---|---|---|
目标 | 5000行 | 30篇 | 400小时 | |
第一周 | 189/189 | 1/1 | 18/18 | |
第二周 | 250/439 | 1/2 | 21/39 | |
第三周 | 437/876 | 2/4 | 25/64 | |
第四周 | 459/1335 | 2/6 | 21/85 | |
第五周 | 547/1882 | 1/7 | 20/115 | |
第六周 | 592/2474 | 2/9 | 25/150 | |
第七周 | 782/3256 | 1/10 | 29/179 | |
第八周 | 830/4086 | 3/13 | 40/219 | |
第九周 | 1300/5386 | 2/15 | 40/259 | |
第九周 | 1000/6386 | 1/16 | 26/285 |
23172321 2017-2018-2 《程序设计与数据结构》第10周学习总结
标签:编写 eth iat 连接 AC 照片 需要 存储 代码行数
原文地址:https://www.cnblogs.com/N-idhogg/p/9063994.html