Greedy Algorithms - Quiz

  • A Making the locally optimal choice at each step to obtain a globally optimal solution
  • B Breaking a problem down into smaller subproblems
  • C Generating all possible solutions and selecting the best one
  • D Searching for a solution by gradually eliminating possibilities
  • A It always guarantees the optimal solution
  • B It can be slow for large input sizes
  • C It requires a lot of memory
  • D It may not always find the globally optimal solution
  • A Finding the shortest path between two nodes in a graph
  • B Computing the greatest common divisor of two numbers
  • C Sorting a list of integers
  • D The traveling salesman problem
  • A It always guarantees the optimal solution
  • B It can be slow for large input sizes
  • C It requires a lot of memory
  • D It may not always find the globally optimal solution
  • A Finding the shortest path between two nodes in a graph
  • B Computing the greatest common divisor of two numbers
  • C Sorting a list of integers
  • D The coin change problem
  • A The knapsack problem
  • B The minimum spanning tree problem
  • C The job scheduling problem
  • D The longest common subsequence problem
  • A Solving a problem by breaking it down into smaller subproblems
  • B Generating all possible solutions and selecting the best one
  • C Repeating the same steps over and over until a solution is found
  • D Making the locally optimal choice at each step to obtain a globally optimal solution
  • A O(n)
  • B O(n log n)
  • C O(n^2)
  • D O(log n)
  • A Selecting a subset of intervals that do not overlap
  • B Sorting the intervals by start time and selecting the earliest start time
  • C Sorting the intervals by end time and selecting the earliest end time
  • D Generating all possible subsets of intervals and selecting the one with the most intervals