Deck 19: Searching and Sorting

ملء الشاشة (f)
exit full mode
سؤال
The choice of which sorting algorithm to use does not affect:

A) How thoroughly 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.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
Which of the following represents the efficiency of the insertion sort?

A) O1)
B) On)
C) On2)
D) None of the above.
سؤال
Selection sort has a Big O of:

A) O2n)
B) On2)
C) O½n2)
D) On2 - n)/2 )
سؤال
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 merge sort operation runs in:

A) Olog n) time.
B) On) time.
C) On log n) time.
D) On2) time.
سؤال
The merge sort algorithm:

A) Can only be used 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.
سؤال
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.
سؤال
Which of the following is not a valid runtime description according to Big O notation?

A) O1)
B) On)
C) On2)
D) All of the above are valid.
سؤال
Which of the following is not true about searching algorithms and their efficiency?

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.
سؤال
An algorithm that requires __________ operations to complete its task on n data elements is said to have a linear runtime.

A) n3 + 9
B) 3 n2 + 3 n + 2
C) 2 n + 1
D) 6
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/10
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 19: Searching and Sorting
1
The choice of which sorting algorithm to use does not affect:

A) How thoroughly 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.
A
2
Which of the following represents the efficiency of the insertion sort?

A) O1)
B) On)
C) On2)
D) None of the above.
C
3
Selection sort has a Big O of:

A) O2n)
B) On2)
C) O½n2)
D) On2 - n)/2 )
B
4
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 10 في هذه المجموعة.
فتح الحزمة
k this deck
5
A merge sort operation runs in:

A) Olog n) time.
B) On) time.
C) On log n) time.
D) On2) time.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 10 في هذه المجموعة.
فتح الحزمة
k this deck
6
The merge sort algorithm:

A) Can only be used 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
7
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
8
Which of the following is not a valid runtime description according to Big O notation?

A) O1)
B) On)
C) On2)
D) All of the above are valid.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 10 في هذه المجموعة.
فتح الحزمة
k this deck
9
Which of the following is not true about searching algorithms and their efficiency?

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
10
An algorithm that requires __________ operations to complete its task on n data elements is said to have a linear runtime.

A) n3 + 9
B) 3 n2 + 3 n + 2
C) 2 n + 1
D) 6
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 10 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 10 في هذه المجموعة.