Deck 14: Searching and Sorting

ملء الشاشة (f)
exit full mode
سؤال
In a selection sort, a list is sorted by selecting elements in the list, one at a time, and moving them to their proper positions.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
In a sequential search, you search an array starting from the middle component.
سؤال
A list is a set of related values that do not necessarily have the same type.
سؤال
To sort a list of 1000, selection sort makes about 5,000 key comparisons.
سؤال
In the binary search algorithm, two key comparisons are made through every iteration of the loop.
سؤال
In insertion sort, during the sorting phase the array containing the list is divided into three sublists.
سؤال
Selection sort swaps the smallest element in the unsorted portion of the list to a new position.
سؤال
Key comparisons are also called item comparisons.
سؤال
Suppose that you have the following list. int[] list = {2, 4, 6, 8, 10, 12, 14, 16}; Further assume that binary search is used to determine whether 15 is in list. When the loop terminates, the value of the index variable last is 6.
سؤال
In a sequential search, the array must be sorted.
سؤال
Selection sort uses nested for loops.
سؤال
A selection sort always starts with the middle element of the list.
سؤال
A sequential search is most efficient for large lists.
سؤال
The selection sort algorithm repeatedly moves the smallest element from the unsorted list to the top of the unsorted list.
سؤال
In selection sort, initially, the entire list, that is, list[0]...list[listLength], is the unsorted list.
سؤال
The insertion sort algorithm sorts a list by repeatedly inserting an element in its proper place into a sorted sublist.
سؤال
A binary search can be performed on both sorted and unsorted lists.
سؤال
On average, the number of comparisons made by a sequential search is equal to one-third the size of the list.
سؤال
Insertion sort makes approximately the same number of key comparisons as item assignments.
سؤال
A binary search starts by comparing the search item to the first item in the list.
سؤال
Suppose that you have the following list. int[] list = {1, 3, 5, 7, 9, 11, 13, 15, 17}; Further assume that binary search is used to determine whether 8 is in list. When the loop terminates, the value of the index variable first is 1.
سؤال
<strong>  What is the minimum number of comparisons that have to be made to find 18 using a sequential search on the list shown in the accompanying figure?</strong> A) 1 C) 3 B) 2 D) 4 <div style=padding-top: 35px>
What is the minimum number of comparisons that have to be made to find 18 using a sequential search on the list shown in the accompanying figure?

A) 1
C) 3
B) 2
D) 4
سؤال
<strong>  In a sequential search, how many key comparisons would have to be made on the list in the accompanying figure to find the number 5?</strong> A) 4 C) 7 B) 5 D) 8 <div style=padding-top: 35px>
In a sequential search, how many key comparisons would have to be made on the list in the accompanying figure to find the number 5?

A) 4
C) 7
B) 5
D) 8
سؤال
Consider the following list. list = {20, 10, 17, 2, 18, 35, 30, 90, 48, 47}; Suppose that sequential search as discussed in the book is used to determine whether 2 is in list. Exactly how many key comparisons are executed by the sequential search algorithm?

A) 3
C) 5
B) 4
D) 8
سؤال
Suppose that you have the following list. int[] list = {5, 10, 15, 20, 25, 30, 35, 40, 45}; Further assume that binary search is used to determine whether 20 is in list. When the loop terminates, the value of the index variable first is 3.
سؤال
In general, if L is a sorted list of size n, to determine whether an element is in L, the binary search makes at most 2 * log2n + 2 key (item) comparisons.
سؤال
If the list in the accompanying figure was sorted, what would be the middle element?

A) 7
C) 24
B) 16
D) 45
سؤال
<strong>  On average in a sequential search, how many comparisons would have to be made to find an element in the list in the accompanying figure?</strong> A) 2 C) 6 B) 5 D) 8 <div style=padding-top: 35px>
On average in a sequential search, how many comparisons would have to be made to find an element in the list in the accompanying figure?

A) 2
C) 6
B) 5
D) 8
سؤال
<strong>  If the list in the accompanying figure was to be searched using a sequential search on an unordered list, how many key comparisons would be made to find the number 44?</strong> A) 1 C) 5 B) 3 D) 6 <div style=padding-top: 35px>
If the list in the accompanying figure was to be searched using a sequential search on an unordered list, how many key comparisons would be made to find the number 44?

A) 1
C) 5
B) 3
D) 6
سؤال
A sequential search is faster than a binary search on sorted lists.
سؤال
Consider the following list. list = {24, 20, 10, 75, 70, 18, 60, 35} Suppose that list is sorted using the selection sort algorithm as discussed in the book. What is the resulting list after two passes of the sorting phase; that is, after two iterations of the outer for loop?

A) list = {10, 18, 24, 20, 75, 70, 60, 35}
B) list = {10, 18, 20, 24, 75, 70, 60, 35}
C) list = {10, 18, 24, 75, 70, 20, 60, 35}
D) list = {10, 20, 24, 75, 70, 20, 60, 35}
سؤال
To determine whether a given item is in an ordered list of length 1024, binary search makes at most 22 key comparisons.
سؤال
<strong>  In a sequential search, how many key comparisons would have to be made on the list in the accompanying figure to find the number 24?</strong> A) 1 C) 3 B) 2 D) 4 <div style=padding-top: 35px>
In a sequential search, how many key comparisons would have to be made on the list in the accompanying figure to find the number 24?

A) 1
C) 3
B) 2
D) 4
سؤال
To design a general-purpose sort method, sortList, to sort a list, which of the following must be parameters of the method sortList. (i) The array containing the list (ii) The length of the list (iii) A boolean variable indicating whether the sort was successful

A) (i)
C) (i) and (ii)
B) (ii)
D) (i), (ii), and (iii)
سؤال
Why can't a binary search be used on the list as it appears in the accompanying figure?

A) Because the list is too big
B) Because the list is not sorted
C) Because it is a list of integers
D) A binary search can be used on the list
سؤال
Consider the following list. list = {24, 20, 10, 75, 70, 18, 60, 35} Suppose that list is sorted using the insertion sort algorithm as discussed in the book. What is the resulting list after two passes of the sorting phase; that is, after three iterations of the for loop?

A) list = {10, 18, 20, 24, 75, 70, 60, 35}
B) list = {10, 20, 24, 75, 70, 18, 60, 35}
C) list = {10, 18, 20, 24, 35, 70, 60, 75}
D) list = {10, 20, 20, 18, 35, 70, 60, 75}
سؤال
If the list in the accompanying figure was sorted using selection sort, which two elements would be swapped first?

A) 5 and 16
C) 5 and 45
B) 65 and 16
D) 7 and 30
سؤال
Consider the following list. list = {20, 10, 17, 2, 18, 35, 30, 90, 48, 47}; Suppose that sequential search as discussed in the book is used to determine whether 95 is in list. Exactly how many key comparisons are executed by the sequential search algorithm?

A) 1
C) 9
B) 8
D) 10
سؤال
Suppose that L is a list of length 100. In a successful search, to determine whether an item is in L, on average the number of key comparisons executed by the sequential search algorithm, as discussed in this book, is ____.

A) 49
C) 51
B) 50
D) 100
سؤال
<strong>  Based on the accompanying figure, in a sequential search, what is the minimum number of comparisons that have to be made if the search item was 10?</strong> A) 0 C) 7 B) 1 D) 8 <div style=padding-top: 35px>
Based on the accompanying figure, in a sequential search, what is the minimum number of comparisons that have to be made if the search item was 10?

A) 0
C) 7
B) 1
D) 8
سؤال
<strong>  If the list in the accompanying figure were to be searched using a sequential search on an ordered list, how many key comparisons would be made to find the number 44?</strong> A) 1 C) 5 B) 3 D) 6 <div style=padding-top: 35px>
If the list in the accompanying figure were to be searched using a sequential search on an ordered list, how many key comparisons would be made to find the number 44?

A) 1
C) 5
B) 3
D) 6
سؤال
What is the maximum number of key comparisons made when searching a list L of length n for an item using a binary search?

A) log n
C) 2
B) 2 * log2n + 2
D) n
سؤال
<strong>  If the list in the accompanying figure was to be searched for the number 44 using a binary search, how many key comparisons would have to be made?</strong> A) 1 C) 5 B) 3 D) 7 <div style=padding-top: 35px>
If the list in the accompanying figure was to be searched for the number 44 using a binary search, how many key comparisons would have to be made?

A) 1
C) 5
B) 3
D) 7
سؤال
Suppose that L is a sorted list of length 1000. To determine whether an item is in L, the maximum number of comparisons executed by the binary search algorithm, as discussed in this book, is ____.

A) 1
C) 500
B) 42
D) None of these
سؤال
Consider the following list. list = {5, 11, 25, 28, 45, 78, 100, 120, 125}; Suppose that binary search as discussed in the book is used to determine whether 28 is in list. Exactly how many key comparisons are executed by binary search?

A) 6
C) 9
B) 7
D) 10
سؤال
Which technique does a binary search use to find an element in a list?

A) divide and conquer
C) first to last
B) row and column
D) hunt and peck
سؤال
<strong>  If a binary search was used on the list in the accompanying figure, which element would the search element be compared to first?</strong> A) 4 C) 44 B) 35 D) 98 <div style=padding-top: 35px>
If a binary search was used on the list in the accompanying figure, which element would the search element be compared to first?

A) 4
C) 44
B) 35
D) 98
سؤال
Consider the following list. list = {5, 11, 25, 28, 45, 78, 100, 120, 125}; Suppose that binary search as discussed in the book is used to determine whether 28 is in list. What are the values of first and last when the while loop in the body of the binarySearch method terminates?

A) first = 3, last = 3
C) first = 2, last = 4
B) first = 0, last = 3
D) None of these
سؤال
Consider the following list. list = {5, 11, 25, 28, 45, 78, 100, 120, 125}; Suppose that binary search as discussed in the book is used to determine whether 110 is in list. Exactly how many key comparisons are executed by binary search?

A) 3
C) 8
B) 5
D) 12
سؤال
Consider the following list. list = {5, 11, 25, 28, 45, 78, 100, 120, 125}; Suppose that binary search as discussed in the book is used to determine whether 110 is in list. What are the values of first and last when the while loop, in the body of the binarySearch method, terminates?

A) first = 6, last = 6
C) first = 7, last = 6
B) first = 6, last = 7
D) None of these
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/50
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 14: Searching and Sorting
1
In a selection sort, a list is sorted by selecting elements in the list, one at a time, and moving them to their proper positions.
True
2
In a sequential search, you search an array starting from the middle component.
False
3
A list is a set of related values that do not necessarily have the same type.
False
4
To sort a list of 1000, selection sort makes about 5,000 key comparisons.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
5
In the binary search algorithm, two key comparisons are made through every iteration of the loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
6
In insertion sort, during the sorting phase the array containing the list is divided into three sublists.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
7
Selection sort swaps the smallest element in the unsorted portion of the list to a new position.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
8
Key comparisons are also called item comparisons.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
9
Suppose that you have the following list. int[] list = {2, 4, 6, 8, 10, 12, 14, 16}; Further assume that binary search is used to determine whether 15 is in list. When the loop terminates, the value of the index variable last is 6.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
10
In a sequential search, the array must be sorted.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
11
Selection sort uses nested for loops.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
12
A selection sort always starts with the middle element of the list.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
13
A sequential search is most efficient for large lists.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
14
The selection sort algorithm repeatedly moves the smallest element from the unsorted list to the top of the unsorted list.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
15
In selection sort, initially, the entire list, that is, list[0]...list[listLength], is the unsorted list.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
16
The insertion sort algorithm sorts a list by repeatedly inserting an element in its proper place into a sorted sublist.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
17
A binary search can be performed on both sorted and unsorted lists.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
18
On average, the number of comparisons made by a sequential search is equal to one-third the size of the list.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
19
Insertion sort makes approximately the same number of key comparisons as item assignments.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
20
A binary search starts by comparing the search item to the first item in the list.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
21
Suppose that you have the following list. int[] list = {1, 3, 5, 7, 9, 11, 13, 15, 17}; Further assume that binary search is used to determine whether 8 is in list. When the loop terminates, the value of the index variable first is 1.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
22
<strong>  What is the minimum number of comparisons that have to be made to find 18 using a sequential search on the list shown in the accompanying figure?</strong> A) 1 C) 3 B) 2 D) 4
What is the minimum number of comparisons that have to be made to find 18 using a sequential search on the list shown in the accompanying figure?

A) 1
C) 3
B) 2
D) 4
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
23
<strong>  In a sequential search, how many key comparisons would have to be made on the list in the accompanying figure to find the number 5?</strong> A) 4 C) 7 B) 5 D) 8
In a sequential search, how many key comparisons would have to be made on the list in the accompanying figure to find the number 5?

A) 4
C) 7
B) 5
D) 8
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
24
Consider the following list. list = {20, 10, 17, 2, 18, 35, 30, 90, 48, 47}; Suppose that sequential search as discussed in the book is used to determine whether 2 is in list. Exactly how many key comparisons are executed by the sequential search algorithm?

A) 3
C) 5
B) 4
D) 8
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
25
Suppose that you have the following list. int[] list = {5, 10, 15, 20, 25, 30, 35, 40, 45}; Further assume that binary search is used to determine whether 20 is in list. When the loop terminates, the value of the index variable first is 3.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
26
In general, if L is a sorted list of size n, to determine whether an element is in L, the binary search makes at most 2 * log2n + 2 key (item) comparisons.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
27
If the list in the accompanying figure was sorted, what would be the middle element?

A) 7
C) 24
B) 16
D) 45
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
28
<strong>  On average in a sequential search, how many comparisons would have to be made to find an element in the list in the accompanying figure?</strong> A) 2 C) 6 B) 5 D) 8
On average in a sequential search, how many comparisons would have to be made to find an element in the list in the accompanying figure?

A) 2
C) 6
B) 5
D) 8
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
29
<strong>  If the list in the accompanying figure was to be searched using a sequential search on an unordered list, how many key comparisons would be made to find the number 44?</strong> A) 1 C) 5 B) 3 D) 6
If the list in the accompanying figure was to be searched using a sequential search on an unordered list, how many key comparisons would be made to find the number 44?

A) 1
C) 5
B) 3
D) 6
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
30
A sequential search is faster than a binary search on sorted lists.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
31
Consider the following list. list = {24, 20, 10, 75, 70, 18, 60, 35} Suppose that list is sorted using the selection sort algorithm as discussed in the book. What is the resulting list after two passes of the sorting phase; that is, after two iterations of the outer for loop?

A) list = {10, 18, 24, 20, 75, 70, 60, 35}
B) list = {10, 18, 20, 24, 75, 70, 60, 35}
C) list = {10, 18, 24, 75, 70, 20, 60, 35}
D) list = {10, 20, 24, 75, 70, 20, 60, 35}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
32
To determine whether a given item is in an ordered list of length 1024, binary search makes at most 22 key comparisons.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
33
<strong>  In a sequential search, how many key comparisons would have to be made on the list in the accompanying figure to find the number 24?</strong> A) 1 C) 3 B) 2 D) 4
In a sequential search, how many key comparisons would have to be made on the list in the accompanying figure to find the number 24?

A) 1
C) 3
B) 2
D) 4
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
34
To design a general-purpose sort method, sortList, to sort a list, which of the following must be parameters of the method sortList. (i) The array containing the list (ii) The length of the list (iii) A boolean variable indicating whether the sort was successful

A) (i)
C) (i) and (ii)
B) (ii)
D) (i), (ii), and (iii)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
35
Why can't a binary search be used on the list as it appears in the accompanying figure?

A) Because the list is too big
B) Because the list is not sorted
C) Because it is a list of integers
D) A binary search can be used on the list
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
36
Consider the following list. list = {24, 20, 10, 75, 70, 18, 60, 35} Suppose that list is sorted using the insertion sort algorithm as discussed in the book. What is the resulting list after two passes of the sorting phase; that is, after three iterations of the for loop?

A) list = {10, 18, 20, 24, 75, 70, 60, 35}
B) list = {10, 20, 24, 75, 70, 18, 60, 35}
C) list = {10, 18, 20, 24, 35, 70, 60, 75}
D) list = {10, 20, 20, 18, 35, 70, 60, 75}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
37
If the list in the accompanying figure was sorted using selection sort, which two elements would be swapped first?

A) 5 and 16
C) 5 and 45
B) 65 and 16
D) 7 and 30
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
38
Consider the following list. list = {20, 10, 17, 2, 18, 35, 30, 90, 48, 47}; Suppose that sequential search as discussed in the book is used to determine whether 95 is in list. Exactly how many key comparisons are executed by the sequential search algorithm?

A) 1
C) 9
B) 8
D) 10
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
39
Suppose that L is a list of length 100. In a successful search, to determine whether an item is in L, on average the number of key comparisons executed by the sequential search algorithm, as discussed in this book, is ____.

A) 49
C) 51
B) 50
D) 100
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
40
<strong>  Based on the accompanying figure, in a sequential search, what is the minimum number of comparisons that have to be made if the search item was 10?</strong> A) 0 C) 7 B) 1 D) 8
Based on the accompanying figure, in a sequential search, what is the minimum number of comparisons that have to be made if the search item was 10?

A) 0
C) 7
B) 1
D) 8
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
41
<strong>  If the list in the accompanying figure were to be searched using a sequential search on an ordered list, how many key comparisons would be made to find the number 44?</strong> A) 1 C) 5 B) 3 D) 6
If the list in the accompanying figure were to be searched using a sequential search on an ordered list, how many key comparisons would be made to find the number 44?

A) 1
C) 5
B) 3
D) 6
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
42
What is the maximum number of key comparisons made when searching a list L of length n for an item using a binary search?

A) log n
C) 2
B) 2 * log2n + 2
D) n
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
43
<strong>  If the list in the accompanying figure was to be searched for the number 44 using a binary search, how many key comparisons would have to be made?</strong> A) 1 C) 5 B) 3 D) 7
If the list in the accompanying figure was to be searched for the number 44 using a binary search, how many key comparisons would have to be made?

A) 1
C) 5
B) 3
D) 7
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
44
Suppose that L is a sorted list of length 1000. To determine whether an item is in L, the maximum number of comparisons executed by the binary search algorithm, as discussed in this book, is ____.

A) 1
C) 500
B) 42
D) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
45
Consider the following list. list = {5, 11, 25, 28, 45, 78, 100, 120, 125}; Suppose that binary search as discussed in the book is used to determine whether 28 is in list. Exactly how many key comparisons are executed by binary search?

A) 6
C) 9
B) 7
D) 10
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
46
Which technique does a binary search use to find an element in a list?

A) divide and conquer
C) first to last
B) row and column
D) hunt and peck
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
47
<strong>  If a binary search was used on the list in the accompanying figure, which element would the search element be compared to first?</strong> A) 4 C) 44 B) 35 D) 98
If a binary search was used on the list in the accompanying figure, which element would the search element be compared to first?

A) 4
C) 44
B) 35
D) 98
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
48
Consider the following list. list = {5, 11, 25, 28, 45, 78, 100, 120, 125}; Suppose that binary search as discussed in the book is used to determine whether 28 is in list. What are the values of first and last when the while loop in the body of the binarySearch method terminates?

A) first = 3, last = 3
C) first = 2, last = 4
B) first = 0, last = 3
D) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
49
Consider the following list. list = {5, 11, 25, 28, 45, 78, 100, 120, 125}; Suppose that binary search as discussed in the book is used to determine whether 110 is in list. Exactly how many key comparisons are executed by binary search?

A) 3
C) 8
B) 5
D) 12
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
50
Consider the following list. list = {5, 11, 25, 28, 45, 78, 100, 120, 125}; Suppose that binary search as discussed in the book is used to determine whether 110 is in list. What are the values of first and last when the while loop, in the body of the binarySearch method, terminates?

A) first = 6, last = 6
C) first = 7, last = 6
B) first = 6, last = 7
D) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.