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 :
- A.
Counting micro seconds
- B.
Counting number of key operations
- C.
Counting number of statements
- 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).