+ 3
C++ time complexity between sort() and manual sorting with loops
In C++ , 1.Using the sort() functions and 2.Using loops to manually sort an array. Which is having more time complexity?And will anyone tell me How to calculate any time complexity?
2 Respuestas
+ 3
std::sort usually uses QuickSort or a in some cases another version of it , IntroSort.
The worst-case time complexity in terms of Big O notation for Quick-Sort is O(n^2).
Manual Sort depend on the algorithm you use.
Refer here for time Complexity of other algorithms:
https://www.geeksforgeeks.org/analysis-of-different-sorting-techniques/
+ 2
Thank you Ćheyat for your valuable response🙏
Happy coding 😀