Deck 8: Sorting

ملء الشاشة (f)
exit full mode
سؤال
The number of comparisons for a selection sort is represented by the series: (n - 1) + (n - 2) + ... + 3 + 2 + 1
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
Insertion sort is considered a quadratic sort.
سؤال
With respect to selection sort, the number of comparisons is O(n).
سؤال
The improvement of Shell sort over insertion sort is much more significant for small arrays.
سؤال
The method sort(int[] items), in class java.util.Arrays, sorts the array item in ascending order.
سؤال
A class that implements the Comparable interface must define a(n) ____________________ method that determines the natural ordering of its objects.
سؤال
____________________ sorts an array by making several passes through the array, selecting the next smallest item each time and placing it where it belongs in the array.
سؤال
In the best case, selection sort makes O(______) comparisons.
سؤال
With respect to merge sort, additional space usage is O(___________________).
سؤال
The idea behind ____________________ sort is to sort many smaller subarrays using insertion sort before sorting the entire array.
سؤال
____________________ sort has O(n3/2) or better performance.
سؤال
Whenever a recursive method is called, a copy of the local variables is saved on the run-time ____________________.
سؤال
The Java API ____________________ provides a class Arrays with several overloaded sort methods for different array types.
سؤال
Insertion sort is an example of a(n) ____________________ sorting algorithm.
سؤال
You can think of the ____________________ sort as a divide-and-conquer approach to insertion sort.
سؤال
The following represents the ____ sort algorithm.
Set the initial value of gap to n / 2.
While gap > 0
For each array element from position gap to the last element
Insert this element where it belongs in its subarray.
If gap is 2, set it to 1.
Else gap = gap/2.2.

A) Shell
B) Heap
C) Insertion
D) Quick
سؤال
The following is the ____ algorithm.
Access the first item from both sequences.
While not finished with either sequence
Compare the current items from the two sequences, copy the smaller current item to the output sequence, and
Access the next item from the input sequence whose item was copied
Copy any remaining items from the first sequence to the output sequence.
Copy any remaining items from the second sequence to the output sequence.

A) Shell sort
B) Selection sort
C) Merge sort
D) Heapsort
سؤال
The following is the ____ algorithm
For fill = 0 to n - 2 do
Set posMin to the subscript of the smallest item starting at subscript fill.
Exchange the item at posMin with the one at fill.

A) Heapsort
B) Insertion sort
C) Selection sort
D) Merge sort
سؤال
In merge sort, the total effort to reconstruct the sorted array through merging is ____.

A) O(1)
B) O(log2n)
C) O(n log n)
D) O(n2)
سؤال
Which of the following sorts is not O(n lg(n))

A) selection
B) heap
C) merge
سؤال
The best sorting algorithms provide ____ average-case behavior and are considerably faster for large arrays.

A) O(1)
B) O(n)
C) O(n2)
D) O(n log n)
سؤال
Which of the following generally gives the worst performance?

A) Selection sort
B) Bubble sort
C) Insertion sort
D) Shell sort
سؤال
Shell sort is ____ if successive powers of 2 are used for gap.

A) O(log n)
B) O(1)
C) O(log2n)
D) O(n2)
سؤال
The following represents the algorithm for ____ sort.
For each array element from the second (nextPos = 1) to the last
Insert the element at nextPos where it belongs in the array, increasing
The length of the sorted subarray by 1 element.

A) merge
B) shell
C) selection
D) insertion
سؤال
The following is the ____ algorithm.
Build a heap by rearranging the elements in an unsorted array.
While the heap is not empty
Remove the first item from the heap by swapping it with the last item in the heap
And restoring the heap property.

A) Quicksort
B) Bubble sort
C) Merge sort
D) In-Place Heapsort
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/25
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 8: Sorting
1
The number of comparisons for a selection sort is represented by the series: (n - 1) + (n - 2) + ... + 3 + 2 + 1
True
2
Insertion sort is considered a quadratic sort.
True
3
With respect to selection sort, the number of comparisons is O(n).
False
4
The improvement of Shell sort over insertion sort is much more significant for small arrays.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
5
The method sort(int[] items), in class java.util.Arrays, sorts the array item in ascending order.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
6
A class that implements the Comparable interface must define a(n) ____________________ method that determines the natural ordering of its objects.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
7
____________________ sorts an array by making several passes through the array, selecting the next smallest item each time and placing it where it belongs in the array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
8
In the best case, selection sort makes O(______) comparisons.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
9
With respect to merge sort, additional space usage is O(___________________).
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
10
The idea behind ____________________ sort is to sort many smaller subarrays using insertion sort before sorting the entire array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
11
____________________ sort has O(n3/2) or better performance.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
12
Whenever a recursive method is called, a copy of the local variables is saved on the run-time ____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
13
The Java API ____________________ provides a class Arrays with several overloaded sort methods for different array types.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
14
Insertion sort is an example of a(n) ____________________ sorting algorithm.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
15
You can think of the ____________________ sort as a divide-and-conquer approach to insertion sort.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
16
The following represents the ____ sort algorithm.
Set the initial value of gap to n / 2.
While gap > 0
For each array element from position gap to the last element
Insert this element where it belongs in its subarray.
If gap is 2, set it to 1.
Else gap = gap/2.2.

A) Shell
B) Heap
C) Insertion
D) Quick
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
17
The following is the ____ algorithm.
Access the first item from both sequences.
While not finished with either sequence
Compare the current items from the two sequences, copy the smaller current item to the output sequence, and
Access the next item from the input sequence whose item was copied
Copy any remaining items from the first sequence to the output sequence.
Copy any remaining items from the second sequence to the output sequence.

A) Shell sort
B) Selection sort
C) Merge sort
D) Heapsort
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
18
The following is the ____ algorithm
For fill = 0 to n - 2 do
Set posMin to the subscript of the smallest item starting at subscript fill.
Exchange the item at posMin with the one at fill.

A) Heapsort
B) Insertion sort
C) Selection sort
D) Merge sort
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
19
In merge sort, the total effort to reconstruct the sorted array through merging is ____.

A) O(1)
B) O(log2n)
C) O(n log n)
D) O(n2)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
20
Which of the following sorts is not O(n lg(n))

A) selection
B) heap
C) merge
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
21
The best sorting algorithms provide ____ average-case behavior and are considerably faster for large arrays.

A) O(1)
B) O(n)
C) O(n2)
D) O(n log n)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
22
Which of the following generally gives the worst performance?

A) Selection sort
B) Bubble sort
C) Insertion sort
D) Shell sort
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
23
Shell sort is ____ if successive powers of 2 are used for gap.

A) O(log n)
B) O(1)
C) O(log2n)
D) O(n2)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
24
The following represents the algorithm for ____ sort.
For each array element from the second (nextPos = 1) to the last
Insert the element at nextPos where it belongs in the array, increasing
The length of the sorted subarray by 1 element.

A) merge
B) shell
C) selection
D) insertion
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
25
The following is the ____ algorithm.
Build a heap by rearranging the elements in an unsorted array.
While the heap is not empty
Remove the first item from the heap by swapping it with the last item in the heap
And restoring the heap property.

A) Quicksort
B) Bubble sort
C) Merge sort
D) In-Place Heapsort
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 25 في هذه المجموعة.