Greedy Algorithms - Quiz

  • AApplication code
  • BType of programming language
  • CStep by step procedure for calculations
  • DNone of above
  • A Solving a problem by breaking it down into smaller subproblems
  • BGenerating all possible solutions and selecting the best one
  • C Repeating the same steps over and over until a solution is found
  • DMaking the locally optimal choice at each step to obtain a globally optimal solution
  • A Finding the shortest path between two nodes in a graph
  • BComputing the greatest common divisor of two numbers
  • CSorting a list of integers
  • D The coin change problem
  • A It always guarantees the optimal solution
  • BIt can be slow for large input sizes
  • CIt requires a lot of memory
  • DIt may not always find the globally optimal solution
  • A It always guarantees the optimal solution
  • BIt can be slow for large input sizes
  • C It requires a lot of memory
  • DIt may not always find the globally optimal solution
  • AFinding the shortest path between two nodes in a graph
  • B Computing the greatest common divisor of two numbers
  • CSorting a list of integers
  • DThe traveling salesman problem
  • AThe knapsack problem
  • BThe minimum spanning tree problem
  • CThe job scheduling problem
  • DThe longest common subsequence problem
  • ASelecting a subset of intervals that do not overlap
  • BSorting the intervals by start time and selecting the earliest start time
  • CSorting the intervals by end time and selecting the earliest end time
  • DGenerating all possible subsets of intervals and selecting the one with the most intervals