Save
...
2.1 Algorithms
2.1.3 Searching and Sorting Algorithms
Understanding the following standard sorting algorithms
Save
Share
Learn
Content
Leaderboard
Share
Learn
Cards (59)
What is the purpose of sorting algorithms?
To arrange data
Sorting algorithms are methods for arranging data in a specific
order
How does Merge Sort divide the dataset?
In half
Merge Sort is generally more efficient than Bubble Sort due to its better
time complexity
.
True
Merge Sort has a time complexity of O(n log n), making it more efficient than
Bubble Sort
.
True
Steps of Bubble Sort
1️⃣ Compare the first two elements
2️⃣ If the first is greater, swap them
3️⃣ Move to the next pair
4️⃣ Repeat until the dataset is sorted
Bubble Sort has a time complexity of O(n^2), making it inefficient for large
datasets
.
True
What is a sorting algorithm used for?
Arranging data in order
Bubble Sort has a time complexity of
O(n^2)
.
True
Merge Sort divides the dataset in
half
Why is Bubble Sort inefficient for large datasets?
Its time complexity is O(n^2)
Insertion Sort has a time complexity of
O(n^2)
.
True
What action is performed on the sorted elements in Insertion Sort to create space for the next element?
Shifting up
Insertion Sort is more efficient than Bubble Sort for
small
datasets.
Selection Sort works by repeatedly finding the
minimum
element in the unsorted part of the dataset.
True
What is the time complexity of Selection Sort?
O(n^2)
Merge Sort is generally more efficient than Bubble Sort for
large
datasets.
What are sorting algorithms used for?
Arranging data
What is the time complexity of Bubble Sort?
O(n^2)
What is the time complexity of Merge Sort?
O(n log n)
How does Insertion Sort work?
Inserts elements iteratively
Selection Sort selects the smallest element and moves it to the
beginning
What is the first step in Bubble Sort?
Compare the first two elements
How does Insertion Sort handle unsorted elements?
Inserts them into sorted portion
Selection Sort repeatedly finds the
minimum
element in the unsorted portion.
What is the time complexity of Selection Sort?
O(n^2)
Selection Sort repeats the process of finding the minimum and swapping until the entire dataset is sorted.
True
Merge Sort has a time complexity of
O(n log n)
What is the first step in Quick Sort?
Select a pivot
Quick Sort uses recursion to sort the left and right partitions after partitioning around the pivot.
True
Merge Sort requires additional space of
O(n)
Bubble Sort has a time complexity of
O(n^2)
, making it inefficient for large datasets.
True
Merge Sort has a time complexity of O(n
log
n), making it more efficient than Bubble Sort for large datasets.
Match the sorting algorithm with its time complexity:
Bubble Sort ↔️ O(n^2)
Merge Sort ↔️ O(n log n)
What is the key operation of Bubble Sort?
Swapping adjacent elements
In Bubble Sort, if the first element is greater than the second, they are
swapped
Why is Bubble Sort inefficient for large datasets?
It requires multiple passes
What is the time complexity of Merge Sort?
O(n log n)
Bubble Sort repeatedly swaps adjacent elements if they are in the wrong
order
What is the time complexity of Merge Sort?
O(n log n)
See all 59 cards