nerdexam
Microsoft

98-361 · Question #359

You are developing a sorting algorithm that uses partitioning and comparison to arrange an array of numbers in the correct order. You write a method that partitions the array so that the items less…

The correct answer is A. static int[] QuickSort(int[] numbers. See the full explanation below for the reasoning.

Question

You are developing a sorting algorithm that uses partitioning and comparison to arrange an array of numbers in the correct order. You write a method that partitions the array so that the items less than pivot go to the left side, whereas the items greater than pivot go to the right side. The partitioning method has the following signature:

  • static int Partition (int[] numbers, int left,
  • int right, int pivotIndex)

Which of the following algorithms should you use to sort the array using the Partition method?

Options

  • Astatic int[] QuickSort(int[] numbers,
  • Bstatic int[] QuickSort(int[] numbers,
  • Cstatic int[] QuickSort(int[] numbers,
  • Dstatic int[] QuickSort(int[] numbers,

How the community answered

(15 responses)
  • A
    73% (11)
  • B
    7% (1)
  • C
    13% (2)
  • D
    7% (1)

Community Discussion

No community discussion yet for this question.

Full 98-361 Practice