Start learning →

Per the lecture, which of these is NOT counted as a single primitive operation?

Aassigning a value to a variable
Bcomparing two scalar values like a < b
Caccessing one cell of an array, A[i]
Dsorting an n-element array into ascending order
Answer & Solution
Correct answer: D. sorting an n-element array into ascending order
Primitive operations are constant-time atomic steps: assignment, comparison, arithmetic, array indexing, method call/return. Sorting n elements is itself a multi-step algorithm whose cost depends on n. It is the THING we count primitive ops for, not a primitive op itself.
Practise this question with Quill — GATE CSE →

Keep practising Algorithms

Browse all Algorithms questions for GATE CSE, or explore more Computer Science topics.

Start a Algorithms lesson →
Related questions