Module 4 Data Structures

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Before you can perform a bubble sort, the data must be stored in descending order

true

If you are using the bubble sort algorithm to sort an array in descending order, the smaller values move toward the end

true

Shell sort, introduced by Donald Shell in 1959 is done by starting the comparison and exchange of elements with elements that are far apart before finishing with neighboring elements

true

The QuickSort algorithm works on the basis of

two sublists and a pivot

The complexity of Merge sort is

0(n log n)

Match the following - (1)Bubble Sort (A) O(n) (2)Shell Sort (B) O(n2) (3)Selection Sort (C) O(n log n)

1 -> B, 2-> C, 3 -> A

Which of the following sorting methods would be most suitable for sorting a list which is almost sorted

Bubble sort

The QuickSort algorithm was developed in 1960 by

C.A.R. Hoare

If the array is already sorted, which of these algorithms will exhibit the best performance

Insertion sort

The following function should swap the values contained in two integer variables, num1 and num2. What, if anything, is wrong with this function? void swap(int num1, int num2) { int temp = num2; num2 = num1; num1 = temp; }

The swap function must use reference parameters

The in-order traversal of tree will yield a sorted listing of elements of tree in

binary search trees

When an array is sorted from highest to lowest, it is said to be in

descending order

The QuickSort algorithm is used to sort

lists stored in arrays or linear linked lists

The following is the pseudocode for which type of algorithm? For start = each array subscript, from the first to the next-to-last minIndex = start minValue = array[start] For index = start + 1 To size - 1 If array[index] < minValue minValue = array[index] minIndex = index End If End For swap array[minIndex] with array[start] End For

selection sort

The following is the pseudocode for which type of algorithm? For maxElement = each subscript in the array, from the last to the first For index = 0 To maxElement - 1 If array[index] > array[index + 1] swap array[index] with array[index + 1] End If End For End For

Bubble sort

Before you can perform a selection sort, the data must be stored in ascending order.

false

For an array of n elements, the worst-case search is just one array element

false

The bubble sort is an easy way to arrange data in ascending order but it cannot arrange data in descending order

false

Data that is to be sorted in ascending order is ordered

from lowest value to highest value

Application of quick sort

graphic card

Assume you have two integer variables, num1 and num2. Which of the following is the correct way to swap the values in these two variables?

int temp = num2; num2 = num1; num1 = temp;

A pivot element to partition unsorted list is used in

quick sort

The __________ algorithm uses recursion to sort a list

quick sort

Which of the following sorting algorithm is of divide-and-conquer type?

quick sort

A __________ algorithm is a method of locating a specific item of information in a larger collection of data

search


संबंधित स्टडी सेट्स

Important People - Monster Test World Wars

View Set

COMM251.50 - Public Relations I: Intro PR (Spring 2021)

View Set

Art Appreciation Unit 5 Study Questions (Valerie Owen)

View Set

Kinesiology midterm (week 1-8 quizzes)

View Set

Pharmacology Chapter 19: Key terms, Notes, PrepU

View Set

Adjectival clauses practice quizlet

View Set