Progaming Chapter 8 Quiz

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

When a binary search is conducted on an array with 1000 elements, at most ___ comparisons will be made.

10 comparisons

Using a linear search to find a value that is stored in the last element of an array of 20,000 elements, ________ element(s) must be compared.

20,000

A linear search can only be implemented with integer values.

False

On average, bubble sort performs fewer comparisons than insertion sort.

False

________ algorithms are used to arrange random data into some order.

Sorting

What must be true about an array before using binary search on that array?

The array must be sorted

When using binary search to locate an item in a list of n sorted elements, about how many comparisons are made?

about long(n) comparisons

When using sequential search to locate an item in a list of n randomly-ordered elements, about how many comparisons are made?

about n comparisons

When using exchange sort to put n randomly-ordered elements in ascending order, about how many comparisons are made?

about n2 comparisons

When using sequential search on an array of length N, on average the algorithm will make N/2 comparisons.

True

A search algorithm that uses a "divide and conquer" approach is

binary search

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

descending

Bubble sort is also known as ___

exchange sort

A binary search begins with the ________ element of an array.

middle

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

search

Which of these sorting algorithms performs the smallest number of exchanges?

selection sort

A(n) ________ search uses a loop to step through an unsorted array from beginning to end.

sequential

Array elements must be ________ before a binary search can be performed.

sorted


Ensembles d'études connexes

Chapter 63: Management of Patients with Neurologic Trauma

View Set

Cardiovascular, Hematological, Lymphatic

View Set

Biology of Humans: Chapter 13 - Body Defense Mechanisms

View Set

Significant Dates, People, and Events in Texas History

View Set

Understanding Industry Structure and Cola Wars

View Set