Bubble sort
6
Bubble Sort Part 1 of 2 - Series
-
Upload
ben-lang -
Category
Technology
-
view
2.465 -
download
1
description
Bubble sort
Transcript of Bubble sort
Bubble Sort
Part 1 of 2 - Series
Overview
• Simplest of all sorts• Compare first 2 elements and swap if out of
order, keep doing for each adjacent pair of elements until end of array – last element is largest element in array
• Do procedure for each next largest element until array is sorted.
Pseudocode
Video Demonstration
• Link
Performance
Worst case performance: O(n^2)Best case performance O(n)
Improvements
• Optimized Bubble Sort
• Comb Sort…