Question: Suppose I spend my weekends implementing this algorithm: method gradeLabs: while there are ungraded labs grade one lab end loop This algorithm is O(n) O(log

  1. Suppose I spend my weekends implementing this algorithm:

    method gradeLabs:

    while there are ungraded labs

    grade one lab

    end loop

    This algorithm is

    O(n) O(log n) O(n ^ 2) recursive nondeterministic

  2. Suppose I deal with my dirty dishes by implementing this pseudocode:

    do:

    Clean a plate

    Throw two plates away

    while there are dirty dishes remaining

    announce that I am finished with the dishes

    This algorithm is:

    O(1) O(log n) O(n) O(n log n) recursive

  3. Which of the following statements is true?

    O(log n) is better than O(n) O(n) is better than O(log n) O(n ^ 2) is better than O(n log n) O(n) is better than O(1) recursive algorithms are always O(log n)

  4. Suppose an instructor calls roll in a class, but only calls the student whose name appears first on the roll. This algorithm is

    O(log n) O(1) O (n ^ 2) O(n)

  5. Suppose I use this algorithm:

    while there are Brussels sprouts remaining:

    eat one Brussels sprout

    throw away half the remaining Brussels sprouts

    This algorithm is

    O(1) O(n) O(log n) O(n ^ 2) note that CSNS can't show a superscript in an answer; read ^2 as "squared"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!