Leo Liu's blog

Tags · Sort

Home

About

Archives

JavascriptAlgorithmSort

Sort Algorithm(1): Elementary Sort Javascript Implement - Selection, Insertion, Bubble Sort

Elementary Sort, The slowest and simplest Sort algorithm, time complexity is O(n^2) Bubble SortAs Its name, the bigger element will be like a heavy item, Sinking to the bottom of the water, and the small one will swim up to the surface Here’s the algorithm animation: Bubble Sort javascript code: 1234567891011121314151617function bubbleSort(a) { for (..

Read more