bubblesort-one-loop

Bubble Sort with one loop

Usage no npm install needed!

<script type="module">
  import bubblesortOneLoop from 'https://cdn.skypack.dev/bubblesort-one-loop';
</script>

README

NPM version">

Bubble Sort with one loop, still with O(n^2) complexity.

Why

Why not? 

Install

$ npm i --save bubblesort-one-loop

Usage

var bubblesort = require('bubblesort-one-loop');

bubblesort([5,4,3,2,1]); // => [1,2,3,4,5]

function cmp(a, b) { return b - a; }

bubblesort([1,2,3,4,5], cmp); // => [5,4,3,2,1]

License

MIT © Catalin Stochita