Skip to content

Latest commit

 

History

History
29 lines (17 loc) · 698 Bytes

File metadata and controls

29 lines (17 loc) · 698 Bytes

Sort.BubbleSort

export function BubbleSort *(array(array, [comparator], [step])*

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 (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

(Array): the sorted array