array_sorting_package
v1.0.0
Published
Array sorting functions
Downloads
2
Readme
This package contains JavaScript implementations of various sorting algorithms:
- Bubble Sort
- Selection Sort
- Insertion Sort
- Merge Sort
- Quick Sort
Bubble Sort
- Function Name: bubbleSort
- Description: Sorts an array by repeatedly swapping the adjacent elements if they are in the wrong order.
- Time Complexity: O(n^2)
Selection Sort
- Function Name: selectionSort
- Description: Sorts an array by repeatedly selecting the minimum element from the unsorted portion and placing it at the beginning.
- Time Complexity: O(n^2)
Insertion Sort
- Function Name: insertionSort
- Description: Sorts an array by inserting each element into its correct position in the sorted portion of the array.
- Time Complexity: O(n^2)
Merge Sort
- Function Name: mergeSort
- Description: Sorts an array by dividing it into two halves, sorting each half recursively, and then merging them together.
- Time Complexity: O(n log n)
Quick Sort
- Function Name: quickSort
- Description: Sorts an array by selecting a pivot element and partitioning the array into two sub-arrays around the pivot.
- Time Complexity: O(n log n)