Skip to content

ankur0904/sorting-code

Sorting Algorithm *Easy* code with Space and Time complexities

This repo contains the easy sorting algorithm code.

  1. Bubble Sort

    • Time:
      • Best: O(n)
      • Worst: O(n^2)
    • Space:
      • Constant: no auxiliary space used
      • O(1)
    • Stable Sorting Algorithm
    • In-place sorting Algorithm
  2. Selection Sort

  • Time: - Best: O(n^2) - Worst: O(n^2)
  • Space:
    • Constant: no auxiliary space used
    • O(1)
  • Not Stable Sorting Algorithm
  • In-place sorting Algorithm
  1. Insertion Sort

    • Time:
      • Best: O(n)
      • Worst: O(n^2)
    • Space:
      • Constant: no auxiliary space used
      • O(1)
    • Stable Sorting Algorithm
    • In-place sorting Algorithm
  2. Counting Sort

    • Time:
      • Best: O(n)
      • Worst: O(n)
    • Space:
      • Constant: no auxiliary space used
      • O(1)
    • Stable Sorting Algorithm
    • In-place sorting Algorithm
  3. Quick Sort

    • Time: (depends on the choosing of pivot element)
      • Best: O(nlogn)
      • Worst: O(n^2)
    • Space:
      • Recursion stack
      • O(n)
    • Not Stable Sorting Algorithm
  4. Merge Sort

    • Time:
      • Best: O(nlogn)
      • Worst: O(nlogn)
    • Space:
      • O(n)
    • Stable Sorting Algorithm

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages