Sort
Quark-dsa supports different sorting algorithms including the bubble sort, insertion sort, selection sort, mergesort, quicksort and radix sort.
import {
BubbleSort,
InsertionSort,
SelectionSort,
MergeSort,
QuickSort,
RadixSort,
} from "quark-dsa";
const list = [-2, 45, 0, 11, -9];
BubbleSort(list); // returns [-9, -2, 0, 11, 45]
InsertionSort(list); // returns [-9, -2, 0, 11, 45]
SelectionSort(list); // returns [-9, -2, 0, 11, 45]
MergeSort(list); // returns [-9, -2, 0, 11, 45]
QuickSort(list); // returns [-9, -2, 0, 11, 45]
RadixSort(list); // returns [-9, -2, 0, 11, 45]