Skip to content

Latest commit

 

History

History
13 lines (7 loc) · 771 Bytes

File metadata and controls

13 lines (7 loc) · 771 Bytes

Sort

  • Bubble Sort: Simple and easy to understand, but not very efficient for large lists.

  • Selection Sort: Selects the smallest (or largest) element and moves it to the beginning (or end) of the list.

  • Insertion Sort: Builds the final sorted array one item at a time, efficient for small datasets.

  • Merge Sort: Divides the array into two halves, sorts them, and then merges them back together. It's very efficient with a time complexity of O(n log n).

  • Quick Sort: Picks an element as a pivot and partitions the array around it. It's efficient with an average time complexity of O(n log n), but can be slow in the worst case.

  • Heap Sort: Uses a binary heap data structure to sort the array. It has a time complexity of O(n log n).