7.03 | sorting algorithms

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/13

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

14 Terms

1
New cards

what is the first step of the bubble sort algorithm?

start at the left-hand end of the list unless specified otherwise

2
New cards

how does the bubble sort algorithm process comparisons?

compare the first and second values and swap if necessary, then continue comparing and swapping adjacent values along the list.

3
New cards

how does bubble sort reduce the list in each pass?

after each pass, the highest unsorted value is fixed at the end of the list, so the next pass excludes the last sorted value.

4
New cards

when does the bubble sort algorithm stop?

when a pass completes with no swaps or the list is reduced to length 1.

5
New cards

what is the first step of the shuttle sort algorithm?

start at the left-hand side of the list unless specified otherwise

6
New cards

how does the first pass of shuttle sort work?

compare the second value with the first and swap if necessary.

7
New cards

how does the shuttle mechanism work in shuttle sort?

if a swap happens, shuttle back to compare and potentially swap previous pairs again.

8
New cards

how does shuttle sort continue through the list?

on each pass, compare the next value with the previous one and shuttle back if swaps occur, repeating this for all passes.

9
New cards

when does shuttle sort stop?

after passes equal to the length of the list have been completed.

10
New cards

what is the first step in quick sort?

choose the first value in the sublist as the pivot unless specified otherwise.

11
New cards

how does quick sort partition the list?

write down values smaller than the pivot, then the pivot, then values not smaller, forming two sublists.

12
New cards

do values need to stay in order during quick sort partitioning?

no, values smaller than the pivot do not need to maintain their original order.

13
New cards

what do you do after the first pass in quick sort?

apply the same procedure to each sublist unless it contains only one entry.

14
New cards

when does quick sort stop?

when all sublists have one or zero elements.