Save
...
1.2 Algorithms
1.2.9 Understanding standard algorithms:
a. Sorting algorithms:
Save
Share
Learn
Content
Leaderboard
Share
Learn
Cards (73)
Sorting algorithms are procedures that arrange elements in a list or array into a specific
order
Merge Sort works by dividing and merging sorted
subarrays
What factors should be analyzed when evaluating sorting algorithms?
Time and space complexity
What are sorting algorithms essential for in computer science?
Data management and optimization
Merge Sort has a time complexity of
O(n log n)
Insertion Sort builds a sorted list one element at a time.
True
What are the key features of Merge Sort?
High efficiency and stability
What is a major disadvantage of Quick Sort?
Unstable and data-sensitive
Basic steps of Bubble Sort:
1️⃣ Compare the first two elements
2️⃣ If they are in the wrong order, swap them
3️⃣ Move to the next pair of elements
4️⃣ Repeat until the entire list is sorted
Bubble Sort works by repeatedly comparing and swapping adjacent elements if they are in the wrong
order
Steps of Bubble Sort in the correct order
1️⃣ Compare the first two elements
2️⃣ If they are in the wrong order, swap them
3️⃣ Move to the next pair of elements
4️⃣ Repeat until the entire list is sorted
Steps of Merge Sort in the correct order
1️⃣ Recursively divide the array into subarrays
2️⃣ Sort each individual subarray
3️⃣ Merge the sorted subarrays
Merge Sort is a stable sorting algorithm, preserving the order of equal elements.
True
Merge Sort's stable sorting and efficient divide-and-conquer approach make it a widely-used
algorithm
Bubble Sort is efficient for large datasets.
False
Merge Sort is a stable sorting
algorithm
.
True
Steps of Bubble Sort in the correct order
1️⃣ Compare the first two elements
2️⃣ If they are in the wrong order, swap them
Merge Sort is a sorting algorithm that uses a divide-and-conquer
approach
What is the time complexity of Merge Sort?
O(n log n)
Steps involved in Quick Sort
1️⃣ Choose a pivot element
2️⃣ Partition the array around the pivot
3️⃣ Apply Quick Sort recursively
Quick Sort has a time complexity of O(n
log
n).
Which sorting algorithm has a space complexity of O(1)?
Bubble Sort
Match the sorting algorithm with its description:
Bubble Sort ↔️ Compares and swaps adjacent elements
Merge Sort ↔️ Divides and merges sorted subarrays
Quick Sort ↔️ Partitions and sorts subarrays recursively
Which sorting algorithm builds a sorted list one element at a time?
Insertion Sort
Bubble Sort
is simple but inefficient for large
datasets
Quick Sort
is fast and space-efficient in many
cases
Bubble Sort
compares and swaps adjacent
elements
Quick Sort partitions and sorts subarrays
recursively
.
True
Which sorting algorithm has the lowest efficiency?
Bubble Sort
Merge Sort
requires extra
memory
Steps of Bubble Sort
1️⃣ Compare the first two elements
2️⃣ If they are in the wrong order, swap them
3️⃣ Move to the next pair of elements
4️⃣ Repeat steps 1-3 until the entire list is sorted
Merge Sort has a time complexity of
O(n log n)
.
True
In Quick Sort, the
pivot
is used to partition the
array
What is the working principle of Bubble Sort?
Compares and swaps adjacent elements
Quick Sort partitions and sorts subarrays
recursively
.
True
Identifying suitable sorting algorithms depends on the specific
data
set and its requirements.
Bubble Sort has a time complexity of
O(n^2)
.
True
What is the time complexity of Quick Sort in average cases?
O(n log n)
Bubble Sort is inefficient for large
datasets
Merge Sort requires extra
memory
.
True
See all 73 cards