Big O analysis Flashcards

1
Q

The space complexity of function considers space taken by the inputs. True or false?

A

False

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

What is the space complexity?

public static int getLargestItem(int[] items) {
int largest = Integer.MIN_VALUE;
for (int item : items) {
if (item > largest) {
largest = item;
}
}
return largest;
}

A

O(1)

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