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.
Related questions
An NP-hard problem differs from an NP-complete one because NP-hard problemsThe first problem proved to be NP-complete wasA problem X is NP-complete if and only ifWhy does theoretical computer science draw the line at 'polynomial-time' for tractability?Which set inclusion is established (i.e., proven, not open)?The class NP is the set of decision problems for whichFloyd-Warshall detects the presence of a negative cycle byTopological sort is well-defined for