为备考学校最后一次CS考试,对错题在此小作总结:
-
Analyzing algorithm efficiency using Big-O is to estimate their growth function ( incorrect answer: to estimate their execution time)
-
default method in the interface can be overriden, while static method cannot. Also, private method in the abstract class cannot be overriden. Another thing is that if an interface has 1 default method and 1 abstract method, it is still functional interface.
-
Linked list is more efficient in adding an element at the front of a list and for deletion. Array list is more efficient when you want to access an element in the list with its index.
-
In the recursion, if the base case is never reached or defined, stack overflow will occur
List<Integer> path = new LinkedList<>();
path.add(24);
path.add(27);
path.add(5);
path.add(90);
path.remove(5);
This will return an array, because here, 5 represents an index not the Integer in it. If you want to use remove(Object E), we should write
path.remove(new Integer(5));