Deck 19: Searching, Sorting and Big O

ملء الشاشة (f)
exit full mode
سؤال
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.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
What is the efficiency of selection sort?

A)O(n2).
B)O(n log n).
C)O(n).
D)O(1).
سؤال
What is the efficiency of linear search?

A)O(1).
B)O(log n).
C)O(n).
D)O(n2).
سؤال
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.
سؤال
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.
سؤال
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.
سؤال
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.
سؤال
What is the efficiency of merge sort?

A)O(log n).
B)O(n).
C)O(n log n).
D)O(n2).
سؤال
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.
سؤال
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.
سؤال
What is the maximum number of comparisons required to find a search key in a 31-element array?

A)4.
B)5.
C)32.
D)1.
سؤال
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.
سؤال
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.
سؤال
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.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/14
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 19: Searching, Sorting and Big O
1
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.
B
2
What is the efficiency of selection sort?

A)O(n2).
B)O(n log n).
C)O(n).
D)O(1).
A
3
What is the efficiency of linear search?

A)O(1).
B)O(log n).
C)O(n).
D)O(n2).
C
4
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 14 في هذه المجموعة.
فتح الحزمة
k this deck
5
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 14 في هذه المجموعة.
فتح الحزمة
k this deck
6
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 14 في هذه المجموعة.
فتح الحزمة
k this deck
7
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 14 في هذه المجموعة.
فتح الحزمة
k this deck
8
What is the efficiency of merge sort?

A)O(log n).
B)O(n).
C)O(n log n).
D)O(n2).
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 14 في هذه المجموعة.
فتح الحزمة
k this deck
9
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 14 في هذه المجموعة.
فتح الحزمة
k this deck
10
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 14 في هذه المجموعة.
فتح الحزمة
k this deck
11
What is the maximum number of comparisons required to find a search key in a 31-element array?

A)4.
B)5.
C)32.
D)1.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 14 في هذه المجموعة.
فتح الحزمة
k this deck
12
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 14 في هذه المجموعة.
فتح الحزمة
k this deck
13
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 14 في هذه المجموعة.
فتح الحزمة
k this deck
14
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 14 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 14 في هذه المجموعة.