Big O/Searching/sorting/algorithms Flashcards
1
Q
What does O(1) represent
A
Constant time complexity (independent of num of elements)
2
Q
O(n)
A
Linear time complexity (directly proportional to num of elements)
3
Q
O(n^2)
A
Polynomial time complexity (example, directly proportional to the square of elements inputted)
4
Q
O(2^n)
A
Exponential time complexity (doubles with each element added)
5
Q
O(log n)
A
Logarithmic time complexity (increase at a smaller rate as the num of elements inputted)
6
Q
Stacks: size()
A
7
Q
Stacks: isEmpty()
A
8
Q
Stacks: peek()
A
9
Q
Stacks: push(element)
A
10
Q
Stacks: pop
A
11
Q
Queues: size()
A
12
Q
Queues: isEmpty()
A
13
Q
Queues: peek()
A
14
Q
Queues: enqueue(element)
A
15
Q
Queues: dequeue()
A