Problem Solving Strategies Flashcards

1
Q

What is the difference between Brute Force and Divide & Conquer?

A

Brute Force checks all cases, Divide & Conquer splits into subproblems.

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

How do you decide whether to use BFS or DFS?

A

BFS is better for shortest paths; DFS is better for tree traversal.

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

When should you use Greedy instead of Dynamic Programming?

A

Greedy makes immediate decisions; DP considers future consequences.

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

How do you optimize a recursive function to avoid stack overflow?

A

Use Tail Recursion or convert to iteration.

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

How do you approach a problem when no obvious algorithm applies?

A

Start with brute force, analyze constraints, refine approach.

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

How do you decide which data structure to use in a problem?

A

Consider operations’ time complexity and problem constraints.

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

What is the Engineering Method?

A

Explore - identify, Brainstorm - consider solutions, Plan - choose best option, Implement, Verify - TEST!

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

What kind of solution should you think about when you here “optimal”, “minimization”, or is an interval or event scheduling platform?

A

GREEDY

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

When is topological sort useful? (Kahns Algo)

A

Task scheduling (e.g., prerequisites in course scheduling)
Dependency resolution (e.g., package managers like npm, pip)
Compiling dependencies in a build system
Deadlock detection (e.g., circular dependencies)

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