Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Sorting and Searching Written Homework Due 10/17/2018 Referense: The List Processing sections at the beginning of Chapter 16 (pages 1070 to 1082 in the 8h

image text in transcribed
Sorting and Searching Written Homework Due 10/17/2018 Referense: The List Processing sections at the beginning of Chapter 16 (pages 1070 to 1082 in the 8h edition; pages 1056 to 1068 in the 7th edition.) Note: the term "comparisons" refers to key comparisons, not index comparisons. Key comparisons are comparisons of list values. A sequential search of a list assumes that the list elements are sorted in ascending order 1. Mark the following statements as true or false a. b. A binary search of a list assumes that the list is sorted. 2. Consider the following list: 63 45 32 98 46 57 28 100 Using a sequential search, how many comparisons are required to determine whether the following items are in the list or not? a. 90 b, 57 c, 63 d. I 20 3. Consider the following list: 2 10 17 45 49 55 68 85 92 98 110 Using the binary search, how many comparisons are required to determine whether the following items are in the list or not? Show the values of first, last, and middle and the number of comparisons after each iteration of the loop. a, 55 b. 7 c. 98 d. 49 Sort the following list using the bubble sort algorithm. Show the list after each iteration of the outer for loop. 26, 45, 17, 65, 33, 55, 12, 18 4. 5. Sort the following list using the selection sort algorithm. Show the list after each iteration of the outer for loop. 36, 55, 17, 35, 63, 85, 12, 48, 3, 66 6. Consider the following list: The first three keys are in order. To move 20 to its proper position using the insertion sort as described in this chapter, exactly how many key comparisons are executed? 5, 18, 25, 20, 55, 22 7. Consider the following list: 7, 28, 31, 40, 5, 20 The first four keys are in order. To move 5 to its proper position using the insertion sort as described in this chapter, exactly how many key comparisons are executed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

2nd Edition

1597499471, 978-1597499477

More Books

Students also viewed these Databases questions