Skip to content
Related Articles

Related Articles

Improve Article

Time Complexities of all Sorting Algorithms

  • Difficulty Level : Easy
  • Last Updated : 28 Jun, 2021
Geek Week

Efficiency of an algorithm depends on two parameters:

1. Time Complexity

2. Space Complexity

Time Complexity: Time Complexity is defined as the number of times a particular instruction set is executed rather than the total time is taken. It is because the total time taken also depends on some external factors like the compiler used, processor’s speed, etc.

Space Complexity: Space Complexity is the total memory space required by the program for its execution.



Both are calculated as the function of input size(n).

One important thing here is that in spite of these parameters the efficiency of an algorithm also depends upon the nature and size of the input. 

Following is a quick revision sheet that you may refer at last minute 

 

AlgorithmTime Complexity 
   BestAverageWorst 
Selection SortΩ(n^2)θ(n^2)O(n^2) 
Bubble SortΩ(n)θ(n^2)O(n^2) 
Insertion SortΩ(n)θ(n^2)O(n^2) 
Heap SortΩ(n log(n))θ(n log(n))O(n log(n)) 
Quick SortΩ(n log(n))θ(n log(n))O(n^2) 
Merge SortΩ(n log(n))θ(n log(n))O(n log(n)) 
Bucket SortΩ(n+k)θ(n+k)O(n^2) 
Radix SortΩ(nk)θ(nk)O(nk) 

  
Also, see: 
 

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
 

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.  To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.

In case you wish to attend live classes with experts, please refer DSA Live Classes for Working Professionals and Competitive Programming Live for Students.

My Personal Notes arrow_drop_up
Recommended Articles
Page :