DSA 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

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 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
4
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
5
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
6
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
7
Q

What is the engineering method?

A

Explore - identify and clarify, Brainstorm - what are differnt ways I can solve? Plan - Choose most viable option. Implement- apply the option. Verify - TEST!!!

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