0
0
DSA Cprogramming~5 mins

Why Backtracking and What Greedy Cannot Solve in DSA C - Quick Recap

Choose your learning style9 modes available
Recall & Review
beginner
What is the main idea behind backtracking?
Backtracking tries all possible options step-by-step and goes back (undoes) when a choice leads to a dead end, ensuring all solutions are explored.
Click to reveal answer
beginner
Why can't greedy algorithms solve all problems?
Greedy algorithms make the best choice at each step without looking ahead, which can miss the overall best solution in problems needing global decisions.
Click to reveal answer
intermediate
Give an example of a problem where greedy fails but backtracking works.
The "Subset Sum" problem: greedy might pick large numbers first and miss a valid subset, but backtracking tries all subsets to find the correct answer.
Click to reveal answer
intermediate
How does backtracking ensure correctness?
By exploring all possible choices and undoing wrong paths, backtracking guarantees finding all valid solutions or the best one if it exists.
Click to reveal answer
beginner
What is a key drawback of backtracking compared to greedy?
Backtracking can be slow because it tries many possibilities, while greedy is faster but may not always find the best solution.
Click to reveal answer
Which approach tries all possible options and backtracks on failure?
ADivide and Conquer
BBacktracking
CGreedy
DDynamic Programming
Why might a greedy algorithm fail to find the best solution?
AIt tries all possibilities
BIt stores all solutions
CIt uses recursion
DIt only looks at the current step
Which problem is a classic example where greedy fails but backtracking succeeds?
ASorting numbers
BBinary Search
CSubset Sum
DFinding maximum
What is a main disadvantage of backtracking?
AIt is slow due to many possibilities
BIt is always incorrect
CIt never finds a solution
DIt uses no recursion
Which algorithm type is best when you need the absolute best solution and can afford more time?
ABacktracking
BGreedy
CHeuristic
DSorting
Explain why greedy algorithms cannot solve all problems and how backtracking helps.
Think about choosing step-by-step vs exploring all paths.
You got /4 concepts.
    Describe a scenario or problem where backtracking is necessary instead of greedy.
    Consider problems where partial choices affect future options.
    You got /4 concepts.