Practice free →
HomeGATE CSEcomputerscienceAlgorithms › Per the lecture, which of these is NOT counted a…

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.
Solve this in the app — GATE CSE practice & 24k+ MCQs →
Related questions