Deck 19: Searching, Sorting and Big O
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/22
العب
ملء الشاشة (f)
Deck 19: Searching, Sorting and Big O
1
Big O notation describes ________.
A)the amount of memory required by an algorithm.
B)the difficulty of writing an algorithm to solve a specific problem.
C)an algorithm's efficiency in terms of the work required to solve a problem.
D)the length of an algorithm for solving a specific problem.
A)the amount of memory required by an algorithm.
B)the difficulty of writing an algorithm to solve a specific problem.
C)an algorithm's efficiency in terms of the work required to solve a problem.
D)the length of an algorithm for solving a specific problem.
C
2
How many comparisons will the linear search algorithm make if the search key is not in an array of 10 elements?
A)0.
B)10.
C)9.
D)5.
A)0.
B)10.
C)9.
D)5.
B
3
How much faster is insertion sort with a 15-element array than with a 60-element array?
A)60 times.
B)4 times.
C)15 times.
D)19 times.
A)60 times.
B)4 times.
C)15 times.
D)19 times.
D
4
The linear search algorithm runs in ________time.
A)quadratic
B)O(n)
C)constant
D)nonlinear
A)quadratic
B)O(n)
C)constant
D)nonlinear
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 22 في هذه المجموعة.
فتح الحزمة
k this deck
5
Using a binary search,what is the maximum number of comparisons required to find a search key in a 31-element sorted array?
A)4.
B)5.
C)32.
D)1.
A)4.
B)5.
C)32.
D)1.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 22 في هذه المجموعة.
فتح الحزمة
k this deck
6
What is the term used for binary search's run time?
A)Linear run time.
B)Quadratic run time.
C)Constant run time.
D)Logarithmic run time.
A)Linear run time.
B)Quadratic run time.
C)Constant run time.
D)Logarithmic run time.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 22 في هذه المجموعة.
فتح الحزمة
k this deck
7
What does the first pass of selection sort do?
A)Splits the array into two approximately equal pieces.
B)Orders the first two elements of the array.
C)Partitions the array into two unequal pieces depending on whether each element in the array is greater or less that some pivot element.
D)Locates the smallest element in the array and swaps it into the zeroth position.
A)Splits the array into two approximately equal pieces.
B)Orders the first two elements of the array.
C)Partitions the array into two unequal pieces depending on whether each element in the array is greater or less that some pivot element.
D)Locates the smallest element in the array and swaps it into the zeroth position.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 22 في هذه المجموعة.
فتح الحزمة
k this deck
8
An O(n)algorithm is referred to as having a _______ run time.
A)constant
B)linear
C)quadratic
D)negative
A)constant
B)linear
C)quadratic
D)negative
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 22 في هذه المجموعة.
فتح الحزمة
k this deck
9
What is the efficiency of linear search?
A)O(1).
B)O(log n).
C)O(n).
D)O(n2).
A)O(1).
B)O(log n).
C)O(n).
D)O(n2).
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 22 في هذه المجموعة.
فتح الحزمة
k this deck
10
Which of the following is not a name for a big O run time?
A)Constant run time.
B)Variable run time.
C)Linear run time.
D)Quadratic run time.
A)Constant run time.
B)Variable run time.
C)Linear run time.
D)Quadratic run time.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 22 في هذه المجموعة.
فتح الحزمة
k this deck
11
A searching algorithm that's O(1)________.
A)requires one comparison
B)does not necessarily require only one comparison
C)can search only an array of one item.
D)None of the above.
A)requires one comparison
B)does not necessarily require only one comparison
C)can search only an array of one item.
D)None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 22 في هذه المجموعة.
فتح الحزمة
k this deck
12
What is the base case for the recursive merge sort algorithm?
A)Any array that is already sorted.
B)A two-element array.
C)A one-element array.
D)A zero-element array.
A)Any array that is already sorted.
B)A two-element array.
C)A one-element array.
D)A zero-element array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 22 في هذه المجموعة.
فتح الحزمة
k this deck
13
Big O notation is concerned with the growth rate of algorithm run times,so ________.
A)constants are dominant
B)constants are ignored
C)constant terms are emphasized
D)constants with large values are more important than those with low values
A)constants are dominant
B)constants are ignored
C)constant terms are emphasized
D)constants with large values are more important than those with low values
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 22 في هذه المجموعة.
فتح الحزمة
k this deck
14
What is the efficiency of selection sort?
A)O(n2).
B)O(n log n).
C)O(n).
D)O(1).
A)O(n2).
B)O(n log n).
C)O(n).
D)O(1).
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 22 في هذه المجموعة.
فتح الحزمة
k this deck
15
Which of the following statements is true?
A)The binary search algorithm is less efficient than the linear search,but it requires that the array be sorted.
B)The binary search algorithm is more efficient than the linear search,but it requires that the array be unsorted.
C)The binary search algorithm is more efficient than the linear search,but it requires that the array be sorted.
D)The binary search algorithm is less efficient than the linear search,but it requires that the array be unsorted.
A)The binary search algorithm is less efficient than the linear search,but it requires that the array be sorted.
B)The binary search algorithm is more efficient than the linear search,but it requires that the array be unsorted.
C)The binary search algorithm is more efficient than the linear search,but it requires that the array be sorted.
D)The binary search algorithm is less efficient than the linear search,but it requires that the array be unsorted.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 22 في هذه المجموعة.
فتح الحزمة
k this deck
16
Which of the following is a negative of binary search?
A)It requires significantly more memory than linear search.
B)It is slower than linear search.
C)The data must be in sorted order.
D)None of the above.
A)It requires significantly more memory than linear search.
B)It is slower than linear search.
C)The data must be in sorted order.
D)None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 22 في هذه المجموعة.
فتح الحزمة
k this deck
17
Different sorting algorithms on a particular array produce the same result;the choice of algorithm affects ________ of the program that implements the algorithm.
A)only the run time
B)the run time and the memory use
C)only the memory use
D)neither the run time nor the memory use
A)only the run time
B)the run time and the memory use
C)only the memory use
D)neither the run time nor the memory use
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 22 في هذه المجموعة.
فتح الحزمة
k this deck
18
What does each iteration of the insertion sort algorithm do?
A)Each iteration takes the next smallest element and inserts it at the beginning of the array.
B)Each iteration takes the next element in the unsorted portion of the array and inserts it into the sorted portion.
C)Sorted subarrays are inserted into the larger array.
D)Each iteration determines the location of a pivot and inserts it into place.
A)Each iteration takes the next smallest element and inserts it at the beginning of the array.
B)Each iteration takes the next element in the unsorted portion of the array and inserts it into the sorted portion.
C)Sorted subarrays are inserted into the larger array.
D)Each iteration determines the location of a pivot and inserts it into place.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 22 في هذه المجموعة.
فتح الحزمة
k this deck
19
Which of the following is a way to sort data?
A)Alphabetically.
B)In increasing numerical order.
C)Based on an account number.
D)All of the above.
A)Alphabetically.
B)In increasing numerical order.
C)Based on an account number.
D)All of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 22 في هذه المجموعة.
فتح الحزمة
k this deck
20
Big O highlights ________ factors and ignores terms that become unimportant with ________ n values.
A)insignificant,low
B)insignificant,high
C)dominant,low
D)dominant,high
A)insignificant,low
B)insignificant,high
C)dominant,low
D)dominant,high
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 22 في هذه المجموعة.
فتح الحزمة
k this deck
21
What is the efficiency of merge sort?
A)O(log n).
B)O(n).
C)O(n log n).
D)O(n2).
A)O(log n).
B)O(n).
C)O(n log n).
D)O(n2).
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 22 في هذه المجموعة.
فتح الحزمة
k this deck
22
Which of the following sorting algorithms is the fastest?
A)Selection sort.
B)Insertion sort.
C)Merge sort.
D)They all run at roughly the same speed.
A)Selection sort.
B)Insertion sort.
C)Merge sort.
D)They all run at roughly the same speed.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 22 في هذه المجموعة.
فتح الحزمة
k this deck