Skip to content

Latest commit

 

History

History
54 lines (36 loc) · 1.32 KB

README.md

File metadata and controls

54 lines (36 loc) · 1.32 KB

Sorting Algorithms Playground

Welcome to the Sorting Algorithms Playground! Here, you can explore different sorting algorithms and have some laughs along the way.

Algorithms Included

1. Bubble Sort

  • Time Complexity:
    • Best Case: O(n)
    • Worst Case: O(n^2)

2. Merge Sort

  • Time Complexity:
    • Best Case: O(n log n)
    • Worst Case: O(n log n)

3. Quick Sort

  • Time Complexity:
    • Best Case: O(n log n)
    • Worst Case: O(n^2)

4. Radix Sort (LSD)

  • Time Complexity:
    • Best Case: O(nk)
    • Worst Case: O(nk)

5. Insertion Sort

  • Time Complexity:
    • Best Case: O(n)
    • Worst Case: O(n^2)

6. Selection Sort

  • Time Complexity:
    • Best Case: O(n^2)
    • Worst Case: O(n^2)

Execution Time with Examples

Let's take an example list [5, 3, 9, 1, 4, 8, 6] and measure the execution time for each algorithm:

  • Bubble Sort: O(n^2) - Can be slow for large datasets.
  • Merge Sort: O(n log n) - Efficient for large datasets.
  • Quick Sort: O(n log n) - Efficient for large datasets, but worst-case scenario exists.
  • Radix Sort (LSD): O(nk) - Efficient for integers with a fixed number of digits.
  • Insertion Sort: O(n^2) - Simple, but less efficient for large datasets.
  • Selection Sort: O(n^2) - Simple, but less efficient for large datasets.

Feel free to explore and have fun with these sorting algorithms! 🚀