Question discussion

After one call of the Lomuto partition procedure (the last element is the pivot; scan from the left and move elements ≤ pivot to the front)…

1709Medium DSSSB TGT Computer Science 0 replies 1 views
0

After one call of the Lomuto partition procedure (the last element is the pivot; scan from the left and move elements ≤ pivot to the front) on the array 4 7 2 9 1 5, the array becomes

  • A4 2 1 9 7 5
  • B1 2 4 5 7 9
  • C4 2 1 5 7 9
  • D2 4 1 5 9 7
Correct answer: C

Explanation

With pivot 5 the elements 4, 2 and 1 are moved to the front in the order met, and the pivot is then swapped into position 3, giving 4 2 1 5 7 9.

Discussion 0

Nobody has replied yet. Start the discussion!