1_Answers_8 - CIS 15BG Answers Chapter 8 Arrays: One...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CIS 15BG Answers Chapter 8 Arrays: One Dimensional Arrays 1. A. Because of its efficiency, binary search is the best search for any array, regardless of its size and order. True / False B. Under what circumstances should we use binary search? 1. The array must be sorted. 2. It is recommended to be used on large arrays, but it could be used on any sorted array. 2. Trace the steps of the binary search algorithm to search the following list: A. target = 24 12, 14, 19 , 24 , 28 , 30, 35 , 39, 42, 44, 50, 55, 58 0 1 2 3 4 5 6 7 8 9 10 11 12 first last first <= last ? mid target ? list[mid] 0 12 true 6 24 < 35 0 5 true 2 24 > 19 3 5 true 4 24 < 28 3 3 true 3 24 == 24 4 3 false B. target = 40 12, 14, 19, 24, 28, 30, 35 , 39 , 42 , 44, 50 , 55, 58, 60 0 1 2 3 4 5 6 7 8 9 10 11 12 13 first last first <= last ? mid target ? list[mid] 0 13 true 6 40 > 35 7 13 true 10 40 < 50 7 9 true 8 40 < 42 7 7 true 7 40 > 39 8 7 false 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CIS 15BG Answers Chapter 8 Arrays: One Dimensional Arrays 3. A.
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

1_Answers_8 - CIS 15BG Answers Chapter 8 Arrays: One...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online