Backtracking is based on ____________ A. Last in first out B. First in first out C. Recursion D. Both Last in first out & Recursion

Last in first out
First in first out
Recursion
Both Last in first out & Recursion

The correct answer is C. Recursion.

Backtracking is a technique used to solve problems that have multiple possible solutions. It works by trying all possible solutions, one at a time, and backtracking when a solution is found to be incorrect.

Recursion is a programming technique in which a function calls itself directly or indirectly. This can be used to implement backtracking, as the function can call itself to try different possible solutions.

A. Last in first out (LIFO) is a data structure in which the last element added is the first element removed. This is not the same as backtracking, as backtracking does not remove elements from a data structure.

B. First in first out (FIFO) is a data structure in which the first element added is the first element removed. This is not the same as backtracking, as backtracking does not remove elements from a data structure.

D. Both Last in first out & Recursion is not the correct answer, as backtracking is not based on both LIFO and recursion.

Exit mobile version