Properties of Sorting Algorithms

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/6

flashcard set

Earn XP

Description and Tags

Stability, Adaptability and In-Placedness of certain Sorting Algorithms

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

7 Terms

1
New cards

Selection Sort

Find the smallest value in the collection of items. Swap it with the first element. This is now apart of our sorted section. Find the smallest number in the unsorted section, swap it with the second element. This is not apart of our sorted section. Etc, etc.


Unstable, Non-adaptive, In-place

2
New cards

Bubble Sort

Compares values in pairs from left to right. Swaps pairs of values if they are out of order. Larger values “bubble” up to the end. If it does a sweep of the array where no swaps are performed, it stops. If the last element of the data is the smallest, this leads to a worst-case time complexity.

Stable, Adaptive, In-place

3
New cards

Take the first element of the array and treat it as sorted. Take the next element and insert it into this sorted part of the array such that order is preserved. Repeat.

Insertion Sort

Stable, Adaptive, In-place

4
New cards

Merge Sort

Split the array into two roughly equal sized part. Recursively sort these partitions. Merge the two now-sorted partitions into a sorted array. (Note, an array of size 1 is already sorted)

Stable, Non-Adaptive, Out-of-place

5
New cards

Naive Quick-Sort

Take the first value in your array. Use this as your pivot. Partition the array so that all elements to the left of the pivot are less than or equal to the pivot. Recursively sort the partitions.

Unstable, Non-adaptive, In-place

6
New cards

Median-Of-Three Quick-Sort

Take the middle number out of the value in the first, middle and last index of your array. Use this as your pivot. Partition the array so that all elements to the left of the pivot are less than or equal to the pivot. Recursively sort the partitions.

Unstable, Non-adaptive, In-place

7
New cards

Radix Sort

Decompose our sorting keys into individual symbols. Ideally, the range of symbols is very small. Stable sort based on last element of the key. Then on second last element… all the way to first element

Stable, Non-adaptive, Out-of-place, Non-comparative