通过这样一个国庆节的假期,心中只有一个想法,这个国庆假期放的,不如不放呢!!php
1、列表集合概念html
操做 | 描述 |
---|---|
add(E element) | 向列表末端添加一个元素 |
add(int index,E element) | 在指定索引处插入一个元素 |
get(int index) | 返回指定索引处的元素 |
remove(int index) | 删除指定索引处的元素 |
remove(E Object) | 删除指定对象的第一个出现 |
set(int index,E element) | 替代指定索引处的元素 |
rsize() | 返回列表中的元素数量 |
2、有序列表java
3、无序列表git
4、索引列表web
问题1解决方案:
(1)举个例子:数组假如要赋值的话,就须要说a[1]=某个值,而数组里该位置的值就会被替代了,可是对于列表而言的话,插入元素不会覆盖原有的值。数组
问题2:在书中107页无序列表的adt中的中间插入的方法介绍是这样写的:数据结构
把元素添加到列表中某个已有元素的后面。学习
可是,这就有个问题了,在以前就有过这个问题,假如在一个列表里面同时出现两个或者两个以上相同的元素怎么办?该如何进行判断?spa
问题2解决方法:
(1)第一个想法就是用键入想插入元素的位置,而不是某一个元素的后面,这样能够保证插入的准确性;
(2)第二个方法就是先在某个元素后面插入,假如出现这个对照的元素有两个的状况,再就细节进行判断,须要插入到哪个的后面。.net
问题1:在书里有rear
变量,做用是什么?
问题1解决:
(1)第一次出现这个变量的时候应该是在咱们学习环形队列的时候,在那个时候,rear表明着数组里的最后一个元素的后一个,因此在不是环形数组里的时候,就能够将其理解为列表中元素的个数。
问题2解决方法:
(1)只能本身学习啦。
(2)Comparable接口
1.什么是Comparable接口
此接口强行对实现它的每一个类的对象进行总体排序。此排序被称为该类的天然排序 ,类的 compareTo方法被称为它的天然比较方法 。实现此接口的对象列表(和数组)能够经过 Collections.sort(和 Arrays.sort )进行自动排序。实现此接口的对象能够用做有序映射表中的键或有序集合中的元素,无需指定比较器。
int compareTo(T o)
比较此对象与指定对象的顺序。若是该对象小于、等于或大于指定对象,则分别返回负整数、零或正整数。
参数: o - 要比较的对象。
返回:负整数、零或正整数,根据此对象是小于、等于仍是大于指定对象。
抛出:ClassCastException - 若是指定对象的类型不容许它与此对象进行比较。
1:A polymorphic reference uses _______________, not the type of the reference, to determine which version of a method to invoke.
A .the type of the object
B .the type of the reference
C .both A and B
D .none of the above
正确答案: A 个人答案: C
解析:多态引用不能使用参考的类型来肯定要调用的方法的版本。
二、In an array implementation of a Stack, the array is ___________ causing the implementation to have to create a new larger array and copy the contents of the stack into the new array in order to expand the capacity of the stack.
A .Dynamic
B .Static
C .Flexible
D .Polymorphic
正确答案: B 个人答案: D
解析:对数组的理解不透彻。
三、By using the interface name as a return type, the interface doesn’t commit the method to the use of any particular class that implements a stack.
A .true
B .false
正确答案: A 个人答案: B
解析:书中有类似的话,理解有误。
四、The implementation of the collection operations should affect the way users interact with the collection.
A .true
B .false
正确答案: B 个人答案: A
解析:在翻译后没有特别看懂题目。
五、A data structure that uses object reference variables to create links between objects is
A .Linked Structure
B .Pointer
C .Self-referential
D .Array
正确答案: A 个人答案: B
解析:没有看清题目,没有看清数据结构几个字,选成了指针。
六、A linked implementation of a stack adds and removes elements from the _______ of the linked list.
A .Front
B .Rear
C .Middle
D .None of the above
正确答案: A 个人答案: D
解析:应该是头删,尾进,题目模糊。
七、The first operation removes an element at the front of the queue and returns a reference to it.
A .True
B .False
正确答案: B 个人答案: A
解析:由于删除操做会移动指针,可是不会返回。
代码调试中的问题和解决过程, 一个问题加1分
同博客开头。。。。。。这个国庆假期真的是太爽了!!!
代码行数(新增/累积) | 博客量(新增/累积) | 学习时间(新增/累积) | |
---|---|---|---|
目标 | 5000行 | 30篇 | 400小时 |
第一周 | 0/0 | 1/1 | 6/6 |
第二周 | 1313/1313 | 1/2 | 20/26 |
第三周 | 901/2214 | 1/3 | 20/46 |
第四周 | 3635/5849 | 2/4 | 20/66 |
蓝墨云班课
Java程序设计与数据结构
串行化
Java中实现对象的比较:Comparable接口和Comparator接口
Comparable接口的实现和使用