Data Structures Algorithms-II MCQs

Page No. 14

Which is the safest method to choose a pivot element?


a choosing a random element as pivot


b choosing the first element as pivot


cchoosing the last element as pivot


dmedian-of-three partitioning method



Find the pivot element from the given input using median-of-three partitioning method. 8, 1, 4, 9, 6, 3, 5, 2, 7, 0.


a8


b7


c 9


d6


View Answer 6

Which of the following methods is the most effective for picking the pivot element?


a first element


blast element


cmedian-of-three partitioning


drandom element



Quick sort follows Divide-and-Conquer strategy.


a True


b False


cA & B


dNone of these


View Answer True

Which of the following sorting algorithms is the fastest?


a Merge sort


bQuick sort


c Insertion sort


dShell sort


View Answer Quick sort

Quick sort is a space-optimised version of ____


aBubble sort


b Selection sort


cInsertion sort


d Binary tree sort


View Answer Binary tree sort

Which one of the following sorting algorithm is best suited to sort an array of 1 million elements?


a Bubble sort


b Insertion sort


cMerge sort


dQuick sort


View Answer Quick sort

A machine needs a minimum of 200 sec to sort 1000 elements by Quick sort. The minimum time needed to sort 200 elements will be approximately __________


a60.2 sec


b45.54 sec


c31.11 sec


d20 sec


View Answer 31.11 sec

Consider the Quick sort algorithm which sorts elements in ascending order using the first element as pivot. Then which of the following input sequence will require a maximum number of comparisons when this algorithm is applied on it?


a22 25 56 67 89


b 52 25 76 67 89


c22 25 76 67 50


d 52 25 89 67 76


View Answer 22 25 56 67 89

Consider the Quick sort algorithm in which the partitioning procedure splits elements into two sub-arrays and each sub-array contains at least one-fourth of the elements. Let T(n) be the number of comparisons required to sort array of n elements. Then T(n)<=?


aT(n) <= 2 T(n/4) + cn


bT(n) <= T(n/4) + T(3n/4) + cn


cT(n) <= 2 T(3n/4) + cn


dT(n) <= T(n/3) + T(3n/4) + cn



Goto Page No.

Page 14 of 149

Alphabetical MCQs Categories

Here below You find all kind of categories of MCQs in alphabetical order.


"Comprehensive Collection of MCQs: Alphabetically Organized by Subject"

"Discover an extensive collection of multiple-choice questions (MCQs) neatly categorized by subject from A to Z. This resource is designed for anyone eager to explore various topics in a straightforward and organized manner. Whether you're a student preparing for exams, an educator seeking supplementary materials, or simply curious about different subjects, this compilation offers a convenient way to learn and assess your knowledge. With questions arranged alphabetically, navigation is effortless, allowing you to delve into subjects of interest at your own pace. Engage, learn, and expand your understanding with this accessible and comprehensive repository of MCQs!"


BolPakistan

bolpakistan.com.pk includes Job Mcqs and Pak Mcqs is the Top Largest Mcqs Forum in World, in which you can read Mcqs of All Subjects, PPSC test preparation, FPSC, NTS and PPSC PAST PAPERS, PPSC PAST MCQS. A Collection of Repeated MCQs for JOBs seekers.

Copyright © 2024, Designed & Developed by BolPakistan