Deck 20: Searching and Sorting

ملء الشاشة (f)
exit full mode
سؤال
At most, how many comparisons are required to search a sorted vector of 1023 elements using the binary search algorithm?

A) 10
B) 15
C) 20
D) 30
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
Which of the following is not a valid runtime description according to Big O notation?

A) O(1)
B) O(n)
C) O(n2)
D) All of the above are valid.
سؤال
Which of the following represents the efficiency of the insertion sort?

A) O(1)
B) O(n)
C) O(n2)
D) None of the above.
سؤال
Selection sort has a Big O of:

A) O(2n)
B) O(n2)
C) O(½n2)
D) O((n2 - n)/2 )
سؤال
The merge sort algorithm:

A) Can be used only on vectors of even length.
B) Works by reducing vectors down to the base case of a two-element vector.
C) Works by merging two sorted vectors into one larger sorted vector.
D) Cannot be implemented recursively.
سؤال
Which of the following statements about searching algorithms and their efficiency is false?

A) The major difference between various searching algorithms is the amount of effort they require to complete the search.
B) Big O notation is one way to describe how likely it is that a searching algorithm will find its target.
C) The effort required to perform a search or a sort is particularly dependent on the number of data elements.
D) A more efficient searching algorithm is usually more complex and difficult to implement.
سؤال
A merge sort operation runs in:

A) O(log n) time.
B) O(n) time.
C) O(n log n) time.
D) O(n2) time.
سؤال
An algorithm that requires __________ operations to complete its task on n data elements is said to have linear runtime.

A) n3 + 9
B) 3 n2 + 3 n + 2
C) 2 n + 1
D) 6
سؤال
The choice of which sorting algorithm to use does not affect:

A) How sorted the vector will be.
B) The time it takes for the sorting operation to complete.
C) The amount of memory used by the program.
D) All of the above will be affected by the choice of sorting algorithm.
سؤال
The first step performed by the binary search algorithm at each iteration is to:

A) Compare the search key with the lowest element in the current subvector.
B) Compare the search key with the middle element in the current subvector.
C) Compare the search key with the highest element in the current subvector.
D) Count the number of elements in the current subvector.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/10
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 20: Searching and Sorting
1
At most, how many comparisons are required to search a sorted vector of 1023 elements using the binary search algorithm?

A) 10
B) 15
C) 20
D) 30
A
2
Which of the following is not a valid runtime description according to Big O notation?

A) O(1)
B) O(n)
C) O(n2)
D) All of the above are valid.
D
3
Which of the following represents the efficiency of the insertion sort?

A) O(1)
B) O(n)
C) O(n2)
D) None of the above.
C
4
Selection sort has a Big O of:

A) O(2n)
B) O(n2)
C) O(½n2)
D) O((n2 - n)/2 )
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 10 في هذه المجموعة.
فتح الحزمة
k this deck
5
The merge sort algorithm:

A) Can be used only on vectors of even length.
B) Works by reducing vectors down to the base case of a two-element vector.
C) Works by merging two sorted vectors into one larger sorted vector.
D) Cannot be implemented recursively.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 10 في هذه المجموعة.
فتح الحزمة
k this deck
6
Which of the following statements about searching algorithms and their efficiency is false?

A) The major difference between various searching algorithms is the amount of effort they require to complete the search.
B) Big O notation is one way to describe how likely it is that a searching algorithm will find its target.
C) The effort required to perform a search or a sort is particularly dependent on the number of data elements.
D) A more efficient searching algorithm is usually more complex and difficult to implement.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 10 في هذه المجموعة.
فتح الحزمة
k this deck
7
A merge sort operation runs in:

A) O(log n) time.
B) O(n) time.
C) O(n log n) time.
D) O(n2) time.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 10 في هذه المجموعة.
فتح الحزمة
k this deck
8
An algorithm that requires __________ operations to complete its task on n data elements is said to have linear runtime.

A) n3 + 9
B) 3 n2 + 3 n + 2
C) 2 n + 1
D) 6
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 10 في هذه المجموعة.
فتح الحزمة
k this deck
9
The choice of which sorting algorithm to use does not affect:

A) How sorted the vector will be.
B) The time it takes for the sorting operation to complete.
C) The amount of memory used by the program.
D) All of the above will be affected by the choice of sorting algorithm.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 10 في هذه المجموعة.
فتح الحزمة
k this deck
10
The first step performed by the binary search algorithm at each iteration is to:

A) Compare the search key with the lowest element in the current subvector.
B) Compare the search key with the middle element in the current subvector.
C) Compare the search key with the highest element in the current subvector.
D) Count the number of elements in the current subvector.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 10 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 10 في هذه المجموعة.