Chap 8

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

Why is the bubble sort inefficient for large arrays?

It moves the items in the array by one element at a time.

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

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 times

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

One time

TF the average number of comparisons performed by a linear search of an array of N elements in N/2

T

The _______search algorithm repeatedly divides the portion of an array being searched in half.

binary

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

10

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

TF the maximum number of comparisons performed by a linear search of an array of N elements in N/2

F. It is N elements

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

False

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.

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

Ascending

The____ search algorithm requires the array's contents to be sorted.

Binary

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

Descending

TF if data are sorted in ascending order, it means they are ordered from lowest to highest value.

True

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

it uses a loop to sequentially step through an array, starting at the first element.

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

linear


Ensembles d'études connexes

Interactive Summary Module 5 Social Media

View Set

Hess&Hunt and Inman: Domain III-Topic B

View Set

Week 4 Check Your Understanding Assignment

View Set

Radiation questions from classmates

View Set

Vocabulario de los dias del arcoiris

View Set