AlixPartners live coding Flashcards

(13 cards)

1
Q

¿Qué significa O(1)?

A

Tiempo constante. La operación siempre toma el mismo tiempo, sin importar el tamaño de la entrada.
Ej: return arr[0];

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

¿Qué significa O(n)?

A

Tiempo lineal. El tiempo crece proporcional al tamaño de la entrada.
Ej: for (let i = 0; i < arr.length; i++)

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

What does O(1) mean?

A

Constant time. The operation always takes the same amount of time, regardless of input size.
Example: return arr[0];

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

What does O(n) mean?

A

Linear time. Time grows proportionally with input size.
Example: for (let i = 0; i < arr.length; i++)

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

What does O(n²) mean?

A

Quadratic time. Two nested loops. Time increases rapidly with input size.
Example: for (i) { for (j) {} }

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

What does O(log n) mean?

A

Logarithmic time. Cuts the problem in half each step.
Example: Binary search.

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

What does O(n log n) mean?

A

Linearithmic time. Common in efficient sorting algorithms.
Example: Merge Sort, average-case Quick Sort.

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

What does O(√n) mean?

A

Square root time. Often used in prime checking or divisor loops.
Example: for (i = 2; i <= sqrt(n); i++)

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

What does O(2ⁿ) mean?

A

Exponential time. Very slow. Often from recursive branching.
Example: Naive recursive Fibonacci

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

What does O(n!) mean?

A

Factorial time. Extremely slow. Seen in permutations and brute-force solutions.
Example: Generating all permutations of a list.

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

What does O(kn) mean?

A

Linear time scaled by a second factor k. Seen in problems with nested input sizes.
Example: Processing n words of length k.

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

What does O(V + E) mean?

A

Graph algorithms. V = vertices, E = edges. Total time scales with graph size.
Example: BFS or DFS traversal.

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

What does O(E log V) mean?

A

Graph algorithms using priority queues (heaps).
Example: Dijkstra’s algorithm with a min-heap.

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