Chapter 8

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Why is the bubble sort inefficient for large array?

Items only move by one element at a time.

IF data is sorted in ascending order, it means they are going from lowest to highest.

T

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

1 time

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

10 comparisons

If a linear 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?

10,000

If data are sorted in descending order, it means they are ordered from lowest value to highest value.

F; Descending is from highest to lowest.

The maximum number of comparisons performed by the linear search on an array of N elements is N/2(assuming values are consistently found).

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

If an array is sorted in__order, the values are stored from lowest to highest.

Ascending

The__ search algorithm repeatedly divides the portion of an array being searched in half.

Binary

The___search algorithm requires that the array's contents be sorted.

Binary

If an array is sorted in __order, the values are stored from highest to lowest.

Descending

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

It takes the smallest value of the array then places it in its final position. Then moves to the next element and does the same thing again until all the items are in the proper place.

Why is the linear search also called "sequential search"?

It uses a loop to sequentially step through an array, starting from the first element. IT compares each elements of the array and stops when either the number is found or the end of the array is encountered.

The ____ search algorithm steps sequentially through an array, comparing each item with the search value.

Linear (Sequential)

The_____ search algorithm is adequate for small arrays but not large arrays.

Linear (Sequential)

In an average case involving an array of N elements, how many times will a linear search function have to read the array to locate a specific value?

N/2

The average number of comparisons performed by the linear search of an array of N elements is N/2(assuming values are consistently found)

T


Ensembles d'études connexes

3-Guide to Computer Forensics and Investigations

View Set

Chemical Equations & Reactions - chpt 8

View Set

How monetary policy works and tools used

View Set

ABI 103 Notes + clickers + discussions

View Set

Accounting Changes and Error Corrections

View Set

Ch 48 Intestinal & Rectal Disorders

View Set