Exam 4 Programming

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

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

The array must be sorted

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

Yes

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

What search algorithm uses a "divide and conquer" approach?

Binary search

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

10

Can a linear search only be implemented with integer values?

No

Does bubble sort perform, on average, fewer comparisons than insertion sort?

No

Bubble Sort is also known as ____

Exchange sort

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

Middle

What ASCII and Unicode character has integer value 0?

NUL

In C++ and most other languages, a string is implemented as an array of characters, terminated by a ___

NUL character

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

Search

Which sorting algorithm performs the smallest number of exchanges

Selection

A ____ search uses a loop to step through an unsorted array from beginning to end

Sequential

____ algorithms are used to arrange random data into some order

Sorting

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

log(n) comparisons

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

n^2

Array elements must be ____ before a binary search can be performed

sorted


Ensembles d'études connexes

Chapter 3 - Cost-Benefit Analysis

View Set

Ch. 13 Head, Face, Neck Including Regional Lymphatics

View Set

Chapter 42: Cardiovascular Dysfunction

View Set

AP Computer Science Principals - Unit 2 Test Answers

View Set

Med Law and Ethics - Mod 3 - Tort Law

View Set

Organizational Behavior: Chapters 1-6

View Set

national real estate questions ( missed )

View Set

Chapter 24: Economics and Suitability

View Set