Identify whether the given problems are Decision Problems, Counting Problems, or Search Problems. Write your answer in front of each problem.

  • Does a given binary string have an even number of zeros?

    This is a Decision Problem because the question asks whether a specific condition (in this case, having an even number of zeros in a binary string) is true or false. Decision problems are problems where the solution is a simple “yes” or “no” answer. In this case, the goal is to check the binary string and determine whether the number of zeros in it is even, providing a binary outcome.

  • Flipping a coin results in heads or tails. If a coin is flipped 20 times, how many different sequences of heads and tails are possible?

    This is a Counting Problem because it asks for the total number of different possible outcomes (sequences) of flipping a coin 20 times. In counting problems, the goal is to determine how many possible combinations, arrangements, or selections can be made given certain constraints or choices. Since each coin flip has 2 possible outcomes (heads or tails), and the coin is flipped 20 times, the total number of possible sequences is calculated by raising 2 to the power of 20.

  • Does a certain Java program say “yes” to an empty input?

    This is a Decision Problem because the question is asking whether a condition holds true for the given input (whether the Java program will output “yes” when the input is empty). Decision problems typically involve determining if a certain state or condition exists, and the solution is always a binary answer—true or false, yes or no.

  • How many ways can the letters of the word TRIANGLE be arranged?

    This is a Counting Problem because it requires calculating the number of distinct ways the letters in the word “TRIANGLE” can be arranged. Counting problems often involve permutations and combinations where you are determining the number of possible arrangements of objects or elements in different scenarios. Since the letters in “TRIANGLE” are all unique, the solution involves finding the number of permutations of the 8 letters, which is 8!8!, or 40,320.

  • The N-queens problem, where the goal is to place eight queens on a chessboard such that no queen attacks any other.

    This is a Search Problem because the task is to search for a valid configuration of the 8 queens on the chessboard that satisfies the constraints. Search problems involve finding a solution from a set of possible solutions that satisfy specific conditions or constraints. In this case, the solution requires finding an arrangement where no two queens share the same row, column, or diagonal.