GATEverse Practice, past papers & mock tests
GATE 2024 · session-1
Programming, Data Structures and AlgorithmsBasic Sorting AlgorithmsmediumMCQ2 marks
Consider the function computeS(X) whose pseudocode is given below: ` computeS(X) S[1] = 1 for i = 2 to length(X) S[i] = -1 if X[i-1] <= X[i] S[i] = S[i-1] + S[i-1] end if end for return S ` Which ONE of the following values is returned by the function computeS(X) for X = [6, 3, 5, 4, 10]?
Save your progress

Related Programming, Data Structures and Algorithms PYQs