What is the main idea behind backtracking in word search problems?
Backtracking tries to build a solution step-by-step, exploring all possible paths and undoing steps (backtracking) when a path does not lead to a solution.
Click to reveal answer
beginner
In a word search grid, how do you decide the next cell to explore during backtracking?
You explore adjacent cells (up, down, left, right) that match the next character in the word and have not been visited yet.
Click to reveal answer
beginner
Why do we mark cells as visited during backtracking in word search?
Marking cells as visited prevents revisiting the same cell in the current path, avoiding cycles and incorrect matches.
Click to reveal answer
beginner
What is the base case for the recursive backtracking function in word search?
The base case is when all characters of the word have been matched successfully, meaning the word is found in the grid.
Click to reveal answer
intermediate
How does backtracking ensure all possible paths are checked in the grid?
Backtracking explores one path fully, then backtracks to try other paths, ensuring every possible route is checked until the word is found or all options are exhausted.
Click to reveal answer
Which directions are typically checked when searching for the next character in a word search grid?
AUp and Left only
BUp, Down, Left, Right
COnly Diagonal
DRandom cells anywhere in the grid
✗ Incorrect
The search moves to adjacent cells in four directions: up, down, left, and right.
What should you do if the current cell's character does not match the word's current character during backtracking?
ABacktrack and try a different path
BContinue exploring neighbors
CMark the cell as visited anyway
DStop the entire search
✗ Incorrect
If the character does not match, backtrack to try other paths.
Why is it important to unmark a cell as visited when backtracking?
AIt is not important
BTo speed up the search
CTo avoid infinite loops
DTo allow revisiting it in other paths
✗ Incorrect
Unmarking allows the cell to be used in different search paths.
What does the backtracking function return when the entire word is found?
ATrue
BFalse
CThe length of the word
DThe grid coordinates
✗ Incorrect
It returns true to indicate the word has been found.
If the word is not found starting from a particular cell, what is the next step?
AReturn true anyway
BStop searching
CTry starting from the next cell in the grid
DMark the word as found
✗ Incorrect
You try starting from the next cell until all cells are checked.
Explain how backtracking works to find a word in a grid step-by-step.
Think about trying paths and undoing steps when stuck.
You got /6 concepts.
Describe why marking and unmarking visited cells is crucial in word search backtracking.
Consider what happens if you don't mark cells.
You got /4 concepts.
Practice
(1/5)
1. What are the four directions checked at each cell during word search backtracking?