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
|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))|
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.
- Know Your Sorting Algorithm | Set 1 (Sorting Weapons used by Programming Languages)
- Know Your Sorting Algorithm | Set 2 (Introsort- C++’s Sorting Weapon)
- Sorting objects using In-Place sorting algorithm
- Sorting integer data from file and calculate execution time
- Case-specific sorting of Strings in O(n) time and O(1) space
- Stability in sorting algorithms
- Lower bound for comparison based sorting algorithms
- Asymptotic Analysis and comparison of sorting algorithms
- Loop Invariant Condition with Examples of Sorting Algorithms
- Sorting Algorithms Visualization : Bubble Sort
- Sorting Algorithms Visualization | Selection Sort
- Difference between Searching and Sorting Algorithms
- The Slowest Sorting Algorithms
- Sorting all array elements except one
- Find the Minimum length Unsorted Subarray, sorting which makes the complete array sorted
- Which sorting algorithm makes minimum number of memory writes?
- A Pancake Sorting Problem
- External Sorting
- Cartesian Tree Sorting
- Sorting 2D Vector in C++ | Set 2 (In descending order by row and column)
Improved By : amandeepkaur93031