Ch8. C++

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

given an array with 1,000 elements using a linear search it might take as many as ________ (on average) to find the target value in a worst case scenario

500

typically, for an array of N items a linear search will find the target value in ________

N/2 attempts

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

middle

in a linear search ________ is the average number of comparisons

N/2 where N is the number of elements in the array

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

Sorting

A(n) ________ search is more efficient than a ________ search.

binary, linear

_________ is inefficient for large arrays because items only move by one element at a time

bubble sort

every time a binary search makes a comparison it ________

eliminates half of the remaining portion of the array that has yet to be searched

Data that is sorted in ascending order is ordered ________.

from lowest to highest value

if an array is sorted with values from lowest to highest it is said to be sorted __________

in ascending order

if an array is sorted from highest element to lowest then it is said to be _______

in descending order

while the big advantage of a linear search is its simplicity its big disadvantage is that _________

it is very inefficient

A(n) ________ search uses a loop to sequentially step through an array.

linear

given an array with 1,000 elements it could be estimated that it would take ________ comparisons to search the array in the worst case scenario

no more than 10

The advantage of a linear search is its ________

simplicity

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

sorted

_________ are used to arrange data in some order

sorting algorithms

if you want to change a value in a vector argument it must be passed into _________

a reference parameter

_________ are used to calculate the maximum number of comparisons the binary search will make on an array of any size

powers of 2

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

search

a ______ is a method of locating a specific item in a larger collection of data

search algorithm

The ________ sort usually performs fewer exchanges than the ________ sort.

selection, bubble


Kaugnay na mga set ng pag-aaral

Vancomycin-Resistant Enterococci (VRE)

View Set

IS 310 Chapter 4-1 (CPU Operation)

View Set

Week 7- Antifungal and Antiviral Agents (Ch 8)

View Set

MH NCLEX Quiz on Addictions/Eating Disorders

View Set

N201 MEDSURG 2: THROMBOCYTOPENIA

View Set

NUR 128 - Labor and Delivery, Ch. 13, 14, 15, 16 -- Ricci, Kyle & Carman Fourth Edition

View Set