Help authour, Buy PDF Ebook >>>Click Here<<<
Data Structure Questions and AnswersQuicksort
Question 1 
QuickSort can be categorized into which of the following?
Brute Force technique  
Divide and conquer  
Greedy algorithm  
Dynamic programming 
Question 1 Explanation:
First you divide(partition) the array based on the pivot element and sort accordingly.
Question 2 
Select the appropriate recursive call for QuickSort.(arr is the array, low is the starting index and high is the ending index of the array, partition returns the pivot element, we will see the code for partition very soon)
public static void quickSort(int[] arr, int low, int high) { int pivot; if(high>low) { pivot = partition(arr, low, high); quickSort(arr, low, pivot1); quickSort(arr, pivot+1,  
public static void quickSort(int[] arr, int low, int high)
{
int pivot;
if(high  
public static void quickSort(int[] arr, int low, int high)
{
int pivot;
if(high>low)
{
pivot = partition(arr, low, high);
quickSort(arr, low, pivot);
quickSort(arr, pivot, high);
}
} class="hk1....stylewrap2">public static void quickSort(int[] arr, int low, int high) { int pivot; if(high>low) { pivot = partition(arr, low, high
What is the worst case complexity of QuickSort?
Question 3 Explanation: When the input array is already sorted.
What is a randomized QuickSort?
Question 4 Explanation: QuickSort is randomized by placing the input data in the randomized fashion in the array or by choosing a random element in the array as a pivot.
Which of the following code performs the partition operation in QuickSort?
Question 5 Explanation: The array is partitioned such that the elements left to the pivot are lesser than the pivot while the elements right of the pivot are greater than the pivot.
There are 5 questions to complete.
Download all FREE PDF Ebook >>>CLICK HERE<<<
Iconic One Theme  Powered by Wordpress
