Fundamentals Flashcards
1
Q
What is an algorithm
A
A self-contained step-by-step set of operations to be performed
2
Q
What are the 4 parts of algorithm analysis
A
- Correctness
- Termination
- Time analysis (number of instructions)
- Space analysis (necessary memory)
3
Q
What are the 4 rules of recursion
A
- Have a base case (end of recursion)
- Make progress towards base case
- Design so that all recursive calls work
- No compound interest, never duplicate work
4
Q
What is it called when you use an object type as the primitive counterpart and vice versa?
A
Autoboxing: primitive -> object
Auto-unboxing: object -> primitive
5
Q
What is it called when you do not have to explicitly define the object type on instantiation?
A
You use the Diamond Operator, and this is called Type Inference
6
Q
What are wildcards used for
A
The ? operator is used on collections for generics, or otherwise you have runtime errors