4.3.5 Sorting Algorithms

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

1/5

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.

6 Terms

1
New cards

What is a sorting algorithm?

An algorithm that sorts elements of an array into a specific order

2
New cards

What are the key sorting algorithms?

- Bubble sort

- Merge sort

3
New cards

How does a bubble sort work?

- Items compared in pairs and swapped if they are in the wrong position

- Passes made until the list is fully ordered

4
New cards

What is the time complexity of a bubble sort?

O(n²) - very inefficient

5
New cards

How does a merge sort work?

Divide and conquer algorithm

- List is split into sub-lists until each list contains one item

- List reformed until one ordered list

6
New cards

What is the time complexity of a merge sort?

O(n log n)