Save
...
Paper 2
Algorithms
Searching and Sorting Algorithms
Save
Share
Learn
Content
Leaderboard
Share
Learn
Created by
Caylin Hindle
Visit profile
Cards (25)
What is a key feature of a bubble sort?
Uses an
outer
while loop
View source
What type of search is a linear search also known as?
Sequential search
View source
What is the main drawback of a linear search for large lists?
It is not very
efficient
View source
What is a key feature of a binary search?
It requires a
sorted list
View source
How does a bubble sort determine when to stop?
Stops when no
swaps
are made
View source
How does a binary search find the target value?
By comparing the
midpoint
to the target
View source
What is the concept behind merge sort?
Divide and conquer
View source
How does merge sort combine the data?
Combines
items
in the
correct
order
View source
What does a bubble sort compare?
Adjacent
data elements
View source
When does an insertion sort stop?
When all elements are
sorted
View source
What is a key feature of a linear search?
Uses a
loop
to check each value
View source
What happens if a match is not found in a linear search?
The value is not
included
View source
What are the key features of a binary search?
Calculates
midpoint
,
lowpoint
, and
highpoint
View source
What does a merge sort do recursively?
Splits
sublists
into left and right
View source
What is a key feature of an insertion sort?
Uses an
outer
for loop
View source
How does an insertion sort find the correct position?
Moves backwards in the
sorted
part
View source
What are the steps to find the number 8 using a linear search in the list 12, 5, 3, 2, 8, 19, 14, 6?
Start at the
first
element
(
12
).
Check if
12
equals
8
(
no
).
Move to the
next
element (5).
Check if 5 equals 8 (no).
Continue checking each element until 8 is found.
View source
How would you find the number 2 using a binary search in the list 1, 2, 3, 4, 5, 6, 7, 8, 9, 10?
Calculate the
midpoint
(5).
Compare midpoint (5) to
target
(2).
Since 2 is less, ignore
upper
half.
New list: 1, 2, 3, 4.
Repeat until 2 is found.
View source
Explain how a merge sort would sort the list 4, 8, 5, 1, 3, 6, 7, 2.
Split the list into
halves
repeatedly.
Continue until each item is separate.
Merge
sublists
back together in order.
Resulting sorted list:
1, 2, 3, 4, 5, 6, 7, 8
.
View source
Describe how a bubble sort would sort the list 3, 1, 6, 5, 2, 4.
Compare
3 and 1,
swap
.
Compare 3 and 6, no swap.
Continue comparing and swapping.
Repeat until no swaps are made.
Resulting sorted list:
1, 2, 3, 4, 5, 6
.
View source
How would an insertion sort sort the list 5, 2, 6, 3, 1, 4?
Start with the first
element
(5).
Compare
and insert 2 before 5.
Continue inserting each element in order.
Resulting
sorted list
:
1, 2, 3, 4, 5, 6
.
View source
What are the key features of a linear search?
Uses a
loop
to check each value
Increments by 1 for each check
Ends if a
match
is found or
list
ends
View source
What are the key features of a binary search?
Calculates
midpoint
,
lowpoint
, and
highpoint
Uses a
while loop
for comparisons
Ignores half of the data each
iteration
View source
What are the key features of a merge sort?
Recursive algorithm
Splits lists until length of 1
Merges
sublists
in correct order
View source
What are the key features of an insertion sort?
Uses an
outer
for loop
Uses an
inner
while loop
for positioning
Moves backwards to find
correct position
View source