Answers 100% Correct
binary search - ANSWER-first checks the middle element of the list. If the
search key is found, the algorithm returns the matching location. If the
search key is not found, the algorithm repeats the search on the remaining
left sublist (if the search key was less than the middle element) or the
remaining right sublist (if the search key was greater than the middle
element)
shell sort - ANSWER-sorting algorithm that treats the input as a collection of
interleaved lists, and sorts each list individually with a variant of the insertion
sort algorithm.
shell sort - ANSWER-Uses gap values to determine the number of interleaved
lists
, insertion sort - ANSWER-sorting algorithm that treats the input as two parts,
a sorted part and an unsorted part, and repeatedly inserts the next value
from the unsorted part into the correct location in the sorted part.
shell sort - ANSWER-def g(numbers, start_index, gap):
for i in range(start_index + gap, len(numbers), gap):
j=i
while (j - gap >= start_index) and (numbers[j] < numbers[j - gap]):
temp = numbers[j]
numbers[j] = numbers[j - gap]
numbers[j - gap] = temp
j = j - gap
def f(numbers, gap_values):
for gap_value in gap_values:
for i in range(gap_value):
g(numbers, i, gap_value)
quicksort - ANSWER-sorting algorithm that repeatedly partitions the input
into low and high parts (each part unsorted), and then recursively sorts each
of those parts.