Searches and Sorts

Ace your homework & exams now with Quizwiz!

What is the smaller index value of a binary search set to?

-1

What value is the larger index value is a binary search set to?

array.length

The merge sort algorithm is said to employ a "___________________" technique.

divide and conquer

The ______________ of a sorting algorithm is usually measured in terms of the number of comparisons that it causes to be made.

efficiency

T/F - A binary search will always be more efficient than a sequential search

false

T/F A sequential search always traverses the entire array during a search?

false

T/F A sequential search of an array of length k always takes k iterations.

false

T/F An insertion sort always requires two arrays to complete a sort.

false

T/F If an array, to be sorted, is in a partially sorted order, the selection sort will be accomplished in less time.

false

T/F In a selection sort you traverse though the entire array (each pass) looking for the largest value.

false

T/F In an insertion sort, during the traversal of the original (unsorted) array, the current largest value is placed in the (array.length-1-interation number) location. (Iteration number starting at 0).

false

T/F The following code will properly swap values in array during a selection sort. int temp = array[i]; array[i] = array[posmax]; array[i] = posmax;

false

The three common index names used in a binary search are

high, low, and probe

what type of loop is preferred for a sequential search

while

How many comparisons would be needed for an array of 450 elements in a selection sort?

101025

In a binary search of 4000 elements in an array what number of iterations will be required?

12

In an insertion sort the least number of comparisons for an array with 276 elements would be _________?

275

what is another name or a sequential search?

linear search

When the time that a sorting algorithm takes to complete its task is approximately proportional to the square of the number of items being sorted, the algorithm is said to run in ______________ time.

quadratic

The merge sort algorithm is ________________.

recursive

The ____ and ____ are the two types of searches discussed in class

sequential search and binary search

To increase the efficiency of a sequential search you can __________ the data.

sort

In a insertion sort can be completed with two arrays. Typically the two array names are

source and destination

T/F A binary search can be used to facilitate an insertion sort algorithm.

true

T/F If the number of items being searched is very large, then on average a binary search is more efficient than a sequential search.

true

T/F In a selection sort you place the largest value found in the (array.length - 1 - iteration number) position. (Iteration number starting at 0)

true


Related study sets

Pharm Chapter 33: Targeted Therapies to Treat Cancer

View Set

LearnSmart Chp. 14 Biotechnology and Genomics

View Set

High Availability and Scalability

View Set