πŸ“’ Too many exams? Don’t know which one suits you best? Book Your Free Expert πŸ‘‰ call Now!

  • google app store apple app store
  • βœ–

      Question

      Which of the following problems is a classic example

      solved using backtracking?
      A Finding the factorial of a number. Correct Answer Incorrect Answer
      B Calculating the nth Fibonacci number. Correct Answer Incorrect Answer
      C The N-Queens Problem. Correct Answer Incorrect Answer
      D Sorting an array using Merge Sort. Correct Answer Incorrect Answer
      E Searching for an element in a sorted array using Binary Search. Correct Answer Incorrect Answer

      Solution

      The N-Queens Problem (placing N chess queens on an NΓ—N chessboard such that no two queens threaten each other) is a canonical example of a problem solved using backtracking. It involves trying to place queens one by one, and if a placement leads to a conflict, the algorithm backtracks to the previous queen and tries a different position.

      Practice Next
      ask-question