Fundamentals Flashcards

1
Q

What is an algorithm

A

A self-contained step-by-step set of operations to be performed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the 4 parts of algorithm analysis

A
  1. Correctness
  2. Termination
  3. Time analysis (number of instructions)
  4. Space analysis (necessary memory)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the 4 rules of recursion

A
  1. Have a base case (end of recursion)
  2. Make progress towards base case
  3. Design so that all recursive calls work
  4. No compound interest, never duplicate work
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are wildcards used for

A

The ? operator is used on collections for generics, or otherwise you have runtime errors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly