Skip to content

Latest commit

 

History

History
32 lines (20 loc) · 697 Bytes

BubbleSort.md

File metadata and controls

32 lines (20 loc) · 697 Bytes

Sort.BubbleSort

BubbleSort(array, [comparator], [step])

A BubbleSort algorithm

This sort works by iterating through the list of values from the start comparing each pair of values and swapping them if they are in the wrong order

Arguments

  1. array (*[]): the input array
  2. [comparator] (Function): a function to compare 2 values *(defaults asc->desc)*
  3. [step] (Function): an optional function that gets applied at each step

Returns

(*): the sorted array