CSC 10 Chapter 9

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

If a sequential search function is searching for a value that is stored in the last element of a 10,000-element array, how many elements will the search code have to read to locate the value?

It will have to look at all 10,000 element in order to find the value in the last element

This algorithm makes several passes through an array and causes the larger values to gradually move toward the end of the array with each pass. a. bubble sort b. selection sort c. insertion sort d. sequential sort

a. bubble sort

This search algorithm is adequate for small arrays but not large arrays. a. sequential search b. binary search c. natural order search d. selection search

a. sequential search

This search algorithm steps sequentially through an array, comparing each item with the search value. a. sequential search b. binary search c. natural order search d. selection search

a. sequential search

This search algorithm repeatedly divides the portion of an array being searched in half. a. sequential search b. binary search c. natural order search d. selection search

b. binary search

This search algorithm requires that the array's content be sorted. a. sequential search b. binary search c. natural order search d. selection search

b. binary search

In this algorithm, the smallest value in the array is located and moved to element 0. a. bubble sort b. selection sort c. insertion sort d. sequential sort

b. selection sort

This type of algorithm rearranges the values stored in an array in some particular order. a. search algorithm b. sorting algorithm c. ordering algorithm d. selection algorithm

b. sorting algorthm

If an array is sorted in this order, the values are stored from lowest to highest. a. asymptotic b. logarithmic c. ascending d. descending

c. ascending

This algorithm begins by sorting the first two elements of the array, which become a sorted subset. a. bubble sort b. selection sort c. insertion sort d. sequential sort

c. insertion sort

List the steps that the selection sort algorithm would make in sorting the following values: 4, 1, 3, 2.

4 1 3 2 1 4 3 2 1 2 3 4

List the steps that the insertion sort algorithm would make in sorting the following values: 4, 1, 3, 2.

4 1 3 2 1 4 3 2 1 3 4 2 1 2 3 4

If an array is sorted in this order, the values are stored from highest to lowest. a. asymptotic b. logarithmic c. ascending d. descending

d. descending

True or False. If data is sorted in descending order, it means it is ordered from lowest value to highest value.

False

True or False. Regardless of the programming language being used, it is not possible to use the bubble sort algorithm to sort strings.

False

True or False. The maximum number of comparisons performed by the sequential search algorithm on an array of n elements is n/2 (assuming the search values are consistently found).

False The maximum is N because it would go through all the numbers.

Why is the bubble sort inefficient for a large arrays?

Because it moves the items in the array only by one element at a time.

A binary search function is searching for a value that happens to be stored in the middle element of an array. How many times will the function read an element in the array before finding the value?

Binary search starts in the middle so if it is found the search is over

Why is the selection sort more efficient than the bubble sort on large arrays?

The selection sort usually performs fewer exchanges because it moves items immediately to their final position in the array.

In an average case involving an array of n element, how many times will a sequential search function have to read the array to locate a specific value?

The sequential search will locate an item in n /2 attempts

True or False. If data sorted in ascending order, it means it is ordered from lowest value to highest value.

True

True or False. The average number of comparisons performed by the sequential search algorithm on an array of n elements is n/2 (assuming the search values are consistently found).

True

What is the maximum number of comparisons that a binary search function will make when searching for a value in a 1,000-element array?

With a 1,000 element this takes no more than 10 comparisons


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

Psych CH14, Anxiety Prep U, MH EX 2 PREP U CH. 14 Anxiety and Anxiety Disorders, anxiety, ch 14 NCLEX questions

View Set

Healthcare Compliance, common laws and regulations

View Set

Head and Neck Anatomy cumulative

View Set