Deck 9: Searching, Sorting, and Algorithm Analysis

ملء الشاشة (f)
exit full mode
سؤال
The linear search is adequate for searching through arrays, but not through ones.

A)char, string
B)any regular, vector
C)int, double
D)ascending, descending
E)small, large
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
A sorting algorithm can be used to arrange a set of in order.

A)numeric values, ascending
B)strings, ascending
C)strings, descending
D)numeric values, descending
E)All of the above.
سؤال
We can estimate the of an algorithm by counting the number of steps it requires to solve a problem.

A)code quality
B)number of lines of code
C)run time
D)efficiency
E)result
سؤال
When an array is sorted from highest to lowest, it is said to be in order.

A)ascending
B)forward
C)downward
D)reverse
E)descending
سؤال
If a binary search is used to search for the number 4 in the 11- element array shown below, which value will the 4 be compared to first? <strong>If a binary search is used to search for the number 4 in the 11- element array shown below, which value will the 4 be compared to first?  </strong> A)1 B)7 C)8 D)9 E)17 <div style=padding-top: 35px>

A)1
B)7
C)8
D)9
E)17
سؤال
If the item being searched for is not in the array, binary search stops looking for it and reports that it is not there when

A)it has examined all the elements in the array.
B)array index first > array index last.
C)it finds a value larger than the search key.
D)Boolean variable found equals true.
E)Boolean variable found equals false.
سؤال
A(n)search is more efficient than a(n)search.

A)integer, double
B)string, double
C)binary, linear
D)linear, binary
E)None of the above. All searches are equally efficient.
سؤال
When sorting an array of objects, if the values in the data member being sorted on are out of order for two objects, it is necessary to

A)swap the entire two objects.
B)examine a different data member.
C)swap one- by- one all data members in the two objects.
D)swap these two data values.
E)stop the sort.
سؤال
The search is adequate for searching through small arrays, but not through large ones.

A)random
B)selection
C)binary
D)linear
E)bubble
سؤال
To locate a value that is in an ordered array of 50 items, linear search must examine at most values.

A)1
B)6
C)25
D)50
E)51
سؤال
A(n)algorithm arranges data into some order.

A)sorting
B)searching
C)binary
D)linear
E)ordering
سؤال
We can measure the complexity of an algorithm that solves a computational problem by determining the number of for an input of size n.

A)times it loops
B)basic steps it requires
C)operations it performs
D)variables it uses
E)output statements it has
سؤال
The advantage of a linear search is that

A)it is simple.
B)it is efficient.
C)it is fast.
D)it can be used on unordered data.
E)both A and D
سؤال
A _ search uses a loop to sequentially step through an array.

A)linear
B)binary
C)bubble
D)relative
E)unary
سؤال
To locate a value in an ordered array of 50 items, binary search must examine at most values.

A)1
B)6
C)10
D)25
E)50
سؤال
Selection sort requires passes to put n data items in order.

A)n/2 +1
B)n/2
C)n+1
D)n
E)n- 1
سؤال
Sorted data can be ordered

A)using a selection sort algorithm.
B)using a bubble sort algorithm.
C)from highest to lowest value.
D)from lowest to highest value.
E)in all of the above ways.
سؤال
A search can be performed on an array of

A)strings.
B)integers.
C)objects.
D)all of the above.
E)A and B, but not C.
سؤال
The sort usually performs fewer exchanges than the sort.

A)selection, bubble
B)bubble, selection
C)linear, bubble
D)linear, binary
E)binary, linear
سؤال
The sort usually performs more exchanges than the sort.

A)binary, linear
B)linear, bubble
C)bubble, selection
D)linear, binary
E)selection, bubble
سؤال
Bubble sort and selection sort can also be used with STL vectors.
سؤال
A binary search begins by examining the _ element of an array.

A)smallest
B)last
C)largest
D)middle
E)first
سؤال
If algorithm A requires 2n + 1 basic operations to process an input of size n, and Algorithm B requires 3n + 2 basic operations to process the same input, algorithm A is considered to be more efficient than Algorithm B.
سؤال
To determine that a item is not in an unordered array of 100 items, linear search must examine an average of values.

A)7
B)10
C)50
D)100
E)101
سؤال
When sorting an array of objects or structures, one must decide which data item to sort on.
سؤال
When sorting an array of objects, if the values in the data member being sorted on are out of order for two objects, those two data values should be swapped.
سؤال
Using a linear search, you are more likely to find an item than if you use a binary search.
سؤال
To determine that a value is not present in an unordered array of 50 items, linear search must examine an average of values.

A)1
B)6
C)25
D)50
E)51
سؤال
To find a value that is in an unordered array of 100 items, linear search must examine an average of values.

A)7
B)10
C)50
D)100
E)101
سؤال
When searching for a particular object in an array of objects, it is necessary to compare the to the value in each examined object's

A)key field, search key.
B)search key, public member data.
C)key field, public member data.
D)search key, private member data.
E)search key, key field.
سؤال
Any sorting algorithm, such as bubble sort or selection sort, that can be used on data stored in an array can also be used on data stored in a vector.
سؤال
If algorithm A requires 2n + 1 basic operations to process an input of size n, and Algorithm B requires 3n + 2 basic operations to process the same input, algorithms A and B are considered to be equally efficient.
سؤال
Using a binary search, you are more likely to find an item than if you use a linear search.
سؤال
To locate a value in an ordered array of 100 items, binary search must examine at most values.

A)7
B)10
C)50
D)100
E)101
سؤال
A binary search requires that the elements be in order.
سؤال
When searching for an item in an unordered set of data, binary search can find the item more quickly than linear search.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/36
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 9: Searching, Sorting, and Algorithm Analysis
1
The linear search is adequate for searching through arrays, but not through ones.

A)char, string
B)any regular, vector
C)int, double
D)ascending, descending
E)small, large
E
2
A sorting algorithm can be used to arrange a set of in order.

A)numeric values, ascending
B)strings, ascending
C)strings, descending
D)numeric values, descending
E)All of the above.
E
3
We can estimate the of an algorithm by counting the number of steps it requires to solve a problem.

A)code quality
B)number of lines of code
C)run time
D)efficiency
E)result
D
4
When an array is sorted from highest to lowest, it is said to be in order.

A)ascending
B)forward
C)downward
D)reverse
E)descending
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
5
If a binary search is used to search for the number 4 in the 11- element array shown below, which value will the 4 be compared to first? <strong>If a binary search is used to search for the number 4 in the 11- element array shown below, which value will the 4 be compared to first?  </strong> A)1 B)7 C)8 D)9 E)17

A)1
B)7
C)8
D)9
E)17
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
6
If the item being searched for is not in the array, binary search stops looking for it and reports that it is not there when

A)it has examined all the elements in the array.
B)array index first > array index last.
C)it finds a value larger than the search key.
D)Boolean variable found equals true.
E)Boolean variable found equals false.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
7
A(n)search is more efficient than a(n)search.

A)integer, double
B)string, double
C)binary, linear
D)linear, binary
E)None of the above. All searches are equally efficient.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
8
When sorting an array of objects, if the values in the data member being sorted on are out of order for two objects, it is necessary to

A)swap the entire two objects.
B)examine a different data member.
C)swap one- by- one all data members in the two objects.
D)swap these two data values.
E)stop the sort.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
9
The search is adequate for searching through small arrays, but not through large ones.

A)random
B)selection
C)binary
D)linear
E)bubble
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
10
To locate a value that is in an ordered array of 50 items, linear search must examine at most values.

A)1
B)6
C)25
D)50
E)51
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
11
A(n)algorithm arranges data into some order.

A)sorting
B)searching
C)binary
D)linear
E)ordering
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
12
We can measure the complexity of an algorithm that solves a computational problem by determining the number of for an input of size n.

A)times it loops
B)basic steps it requires
C)operations it performs
D)variables it uses
E)output statements it has
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
13
The advantage of a linear search is that

A)it is simple.
B)it is efficient.
C)it is fast.
D)it can be used on unordered data.
E)both A and D
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
14
A _ search uses a loop to sequentially step through an array.

A)linear
B)binary
C)bubble
D)relative
E)unary
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
15
To locate a value in an ordered array of 50 items, binary search must examine at most values.

A)1
B)6
C)10
D)25
E)50
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
16
Selection sort requires passes to put n data items in order.

A)n/2 +1
B)n/2
C)n+1
D)n
E)n- 1
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
17
Sorted data can be ordered

A)using a selection sort algorithm.
B)using a bubble sort algorithm.
C)from highest to lowest value.
D)from lowest to highest value.
E)in all of the above ways.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
18
A search can be performed on an array of

A)strings.
B)integers.
C)objects.
D)all of the above.
E)A and B, but not C.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
19
The sort usually performs fewer exchanges than the sort.

A)selection, bubble
B)bubble, selection
C)linear, bubble
D)linear, binary
E)binary, linear
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
20
The sort usually performs more exchanges than the sort.

A)binary, linear
B)linear, bubble
C)bubble, selection
D)linear, binary
E)selection, bubble
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
21
Bubble sort and selection sort can also be used with STL vectors.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
22
A binary search begins by examining the _ element of an array.

A)smallest
B)last
C)largest
D)middle
E)first
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
23
If algorithm A requires 2n + 1 basic operations to process an input of size n, and Algorithm B requires 3n + 2 basic operations to process the same input, algorithm A is considered to be more efficient than Algorithm B.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
24
To determine that a item is not in an unordered array of 100 items, linear search must examine an average of values.

A)7
B)10
C)50
D)100
E)101
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
25
When sorting an array of objects or structures, one must decide which data item to sort on.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
26
When sorting an array of objects, if the values in the data member being sorted on are out of order for two objects, those two data values should be swapped.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
27
Using a linear search, you are more likely to find an item than if you use a binary search.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
28
To determine that a value is not present in an unordered array of 50 items, linear search must examine an average of values.

A)1
B)6
C)25
D)50
E)51
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
29
To find a value that is in an unordered array of 100 items, linear search must examine an average of values.

A)7
B)10
C)50
D)100
E)101
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
30
When searching for a particular object in an array of objects, it is necessary to compare the to the value in each examined object's

A)key field, search key.
B)search key, public member data.
C)key field, public member data.
D)search key, private member data.
E)search key, key field.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
31
Any sorting algorithm, such as bubble sort or selection sort, that can be used on data stored in an array can also be used on data stored in a vector.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
32
If algorithm A requires 2n + 1 basic operations to process an input of size n, and Algorithm B requires 3n + 2 basic operations to process the same input, algorithms A and B are considered to be equally efficient.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
33
Using a binary search, you are more likely to find an item than if you use a linear search.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
34
To locate a value in an ordered array of 100 items, binary search must examine at most values.

A)7
B)10
C)50
D)100
E)101
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
35
A binary search requires that the elements be in order.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
36
When searching for an item in an unordered set of data, binary search can find the item more quickly than linear search.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 36 في هذه المجموعة.