Given the following algorithm for sorting an array X of N numbers: SUBROUTINE…
PYQ GATE 2007Modified — slightly modified from the official paper; see the solution
Given the following algorithm for sorting an array X of N numbers:
SUBROUTINE SORT(X,N)
IF (N < 2)
RETURN
FOR (i = 2 TO N INCREMENT BY 1)
FOR (j = 1 TO i INCREMENT BY 1)
IF (X[i] > X[j])
CONTINUE
TEMP = X[i]
X[i] = X[j]
X[j] = TEMP
END FOR
END FOR
END SUBROUTINEA good approximation of Halstead's estimated program length is
For counting distinct operators, treat each opening or closing delimiter as a separate operator; count the routine name and the closing constructs END FOR and END SUBROUTINE separately.
- A.
20
- B.
50
- C.
80
- D.
110
Attempted by 47 students.
Sign up free to check your answer
Sign up freeLoading lesson…

