📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!


    Question

    What is a common disadvantage of greedy

    algorithms?
    A They always have high time complexity. Correct Answer Incorrect Answer
    B They often require complex data structures. Correct Answer Incorrect Answer
    C They may not always find the globally optimal solution. Correct Answer Incorrect Answer
    D They are difficult to implement. Correct Answer Incorrect Answer
    E They cannot be used for optimization problems. Correct Answer Incorrect Answer

    Solution

    The main drawback of greedy algorithms is that a locally optimal choice does not always lead to a globally optimal solution. While they are often simple and efficient, their applicability is limited to problems exhibiting the greedy choice property and optimal substructure. For problems like the 0/1 Knapsack, a greedy approach (e.g., by value-to-weight ratio) does not guarantee optimality.

    Practice Next
    ask-question