MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Suppose we are sorting an array of eight integers using quick sort, and we have just finished the first partitioning with the array looking like this:2 5 1 7 9 12 11 10Identify the correct statement?
A
Neither the 7 nor the 9 is the pivot.
B
The pivot could be either the 7 or the 9.
C
The pivot is not the 7, but it could be the 9.
D
The pivot could be the 7, but it is not the 9.
Explanation: 

Detailed explanation-1: -In the Bubble Sort algorithm, the swap function that swaps two elements in a list can be called in a Bubble Sort function to iteratively swap an element with its adjacent neighbor whose value is smaller until all the elements are sorted in ascending order.

Detailed explanation-2: -Selection Sort is one of the simplest sorting algorithms. This algorithm gets its name from the way it iterates through the array: it selects the current smallest element, and swaps it into place. Here’s how it works: Find the smallest element in the array and swap it with the first element.

Detailed explanation-3: -Quicksort uses  2 N ln N compares (and one-sixth that many exchanges) on the average to sort an array of length N with distinct keys.

There is 1 question to complete.