To determine the efficiency of an algorithm the time factor is measured by :

2015

To determine the efficiency of an algorithm the time factor is measured by :

  1. A.

    Counting micro seconds

  2. B.

    Counting number of key operations

  3. C.

    Counting number of statements

  4. D.

    Counting kilobytes of algorithm

Attempted by 499 students.

Show answer & explanation

Correct answer: B

Correct approach: measure time by counting the number of key (elementary) operations as a function of input size.

  • What to count: A key operation is the primitive step that dominates running time (for example, comparisons, assignments, or arithmetic operations).

  • Why this measure: Counting key operations abstracts away hardware and implementation details and lets us express how running time grows with input size using asymptotic notation (Big O, Theta, Omega).

  • Why not use microseconds: Wall-clock time depends on machine speed, system load, and compiler optimizations, so it is not a machine-independent measure of algorithmic efficiency.

  • Why not count statements: Different statements can have different costs and may hide multiple operations; counting key operations focuses on the dominant cost components.

  • Why not count kilobytes: Kilobytes measure memory (space), not time; they are relevant to space complexity, not time complexity.

  • Example: A loop that performs one key operation per iteration over n items does n key operations, so its time grows linearly and is written O(n).

Explore the full course: Coding For Placement