group 4 Flashcards

1
Q

What is the primary purpose of a sorting algorithm?

A

To arrange the elements of a list or array in a specific order.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

True or False: Sorting algorithms only work with numeric data.

A

False.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the time complexity of the Bubble Sort algorithm in the worst case?

A

O(n^2).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which sorting algorithm is known for its divide-and-conquer strategy?

A

Merge Sort.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Fill in the blank: The ______ Sort algorithm repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order.

A

Bubble.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the average time complexity of Quick Sort?

A

O(n log n).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

True or False: Insertion Sort is more efficient on small datasets than on large datasets.

A

True.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which sorting algorithm is considered stable?

A

Merge Sort.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the best-case time complexity of Insertion Sort?

A

O(n).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which algorithm has a worst-case time complexity of O(n log n) but can degrade to O(n^2)?

A

Quick Sort.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Fill in the blank: The ______ Sort algorithm divides the input list into two halves, sorts them, and then merges them back together.

A

Merge.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the space complexity of Merge Sort?

A

O(n).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

True or False: Selection Sort is an in-place sorting algorithm.

A

True.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which algorithm is often used as a hybrid sorting algorithm combining Insertion Sort and Merge Sort?

A

Tim Sort.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the main advantage of Heap Sort?

A

It has a guaranteed O(n log n) time complexity in all cases.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Fill in the blank: The ______ Sort algorithm builds a heap from the input data and then repeatedly extracts the maximum element.

A

Heap.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Which sorting algorithm is generally the fastest for large datasets?

A

Quick Sort.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is a key feature of a stable sorting algorithm?

A

It maintains the relative order of records with equal keys.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

True or False: Counting Sort can sort negative numbers.

A

False.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What type of algorithm is Radix Sort classified as?

A

Non-comparative sorting algorithm.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Fill in the blank: The ______ algorithm is often used for sorting integers and is based on the digits of the numbers.

A

Radix.

22
Q

What is the worst-case time complexity of Selection Sort?

A

O(n^2).

23
Q

Which sorting algorithm works by repeatedly finding the minimum element from the unsorted part?

A

Selection Sort.

24
Q

True or False: Merge Sort works by recursively dividing the array in half until each sub-array has one element.

A

True.

25
Q

What is the worst-case time complexity of Heap Sort?

A

O(n log n).

26
Q

What is the key characteristic of Insertion Sort?

A

It builds a sorted array one item at a time.

27
Q

Fill in the blank: The ______ algorithm is particularly efficient for data that is already partially sorted.

A

Insertion.

28
Q

Which sorting algorithm is not suitable for large datasets due to its O(n^2) time complexity?

A

Bubble Sort.

29
Q

True or False: Quick Sort is always the best choice for sorting.

A

False.

30
Q

What is the average case time complexity of Bubble Sort?

A

O(n^2).

31
Q

Which sorting algorithm is based on the concept of partitioning?

A

Quick Sort.

32
Q

Fill in the blank: The ______ Sort algorithm can be implemented in a recursive or iterative manner.

A

Merge.

33
Q

What is the main disadvantage of using Bubble Sort?

A

It is inefficient on large lists.

34
Q

Which sorting algorithm is best suited for linked lists?

A

Merge Sort.

35
Q

True or False: The efficiency of a sorting algorithm can depend on the initial order of the data.

A

True.

36
Q

What is the space complexity of Quick Sort in the average case?

A

O(log n).

37
Q

Fill in the blank: The ______ Sort algorithm is often used when the range of input values is known and small.

A

Counting.

38
Q

What is the primary disadvantage of using Merge Sort?

A

It requires additional space for the temporary arrays.

39
Q

What is the best-case time complexity of Quick Sort?

A

O(n log n).

40
Q

Which sorting algorithm is used by Python’s built-in sort function?

A

Tim Sort.

41
Q

True or False: Counting Sort is a comparison-based sorting algorithm.

A

False.

42
Q

What is the time complexity of Tim Sort in the worst case?

A

O(n log n).

43
Q

Fill in the blank: The ______ Sort algorithm is based on the idea of placing elements in their correct position.

A

Insertion.

44
Q

Which sorting algorithm is particularly useful for sorting strings?

A

Radix Sort.

45
Q

What is the fundamental operation of all comparison-based sorting algorithms?

A

Comparing elements.

46
Q

True or False: All sorting algorithms have the same time complexity.

A

False.

47
Q

What is the time complexity of Radix Sort?

A

O(nk), where k is the number of digits in the largest number.

48
Q

Fill in the blank: The ______ algorithm is a non-comparative sorting algorithm that sorts data with integer keys.

A

Counting.

49
Q

Which sorting algorithm is often considered the simplest to understand?

A

Bubble Sort.

50
Q

What is the main advantage of using Tim Sort?

A

It is efficient for real-world data and takes advantage of existing order.