C++ CH8

¡Supera tus tareas y exámenes ahora con Quizwiz!

warning

warning. The binary search algorithm will not work properly unless the values in the array are sorted.

sorting algorithm

A _____ is a technique for scanning through an array and rearranging its contents in some specific order. Two types: bubble and selection.

concept.

concept. A search algorithm is a method of locating a specific item in a larger collection of data.

concept.

concept. Sorting algorithms are used to arrange data into some order.

concept.

concept. The sorting and searching algorithms you have studied in this chapter may be applied to STL vectors as well as arrays.

Binary search

The _____ is a clever algorithm that is much more efficient than the linear search. Its only requirement is that the values in the array be sorted in order. This algorithm starts with the element in the middle.

Linear search

The _____ is a very simple algorithm. Sometimes called sequential search, it uses a loop to sequentially step through an array, starting with the first element. It compares each element with the value being searched for and stops when either the value is found or the end of the array is encountered.

Bubble sort

The _____ is an easy way to arrange data in ascending or descending order.

selection sort

The _____ usually performs fewer exchanges because it moves items immediately to their final position in the array. It works like this: The smallest value in the array is located and moved to element 0. Then the next smallest value is located and moved to element 1. This process continues until all of the elements have been placed in their proper order.


Conjuntos de estudio relacionados

Chapters 1, 2, 4: The Principles of Economics

View Set

Fluid- electrolyte and acid base balance

View Set

Grade 3 French - Qui suis-je? (Who am I? Jobs)

View Set

Physics Chapter 20 and 21 questions

View Set