loading...

re: Sorting Algorithms with Javascript (Part 1) VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Hello guy ! Nice post ! What is the faster sort algorithm ? Is it depends of number of elements ?
 

Thanks for reading!

In this case, Merge sort is the faster of the three with time complexity O(nlogn). Time complexity (the estimated time taken by running an algorithm) is measured by how many operations are executed so yes, the number of elements will matter, but not as much as the order of the elements:

  • Worst-case time complexity (input elements in reversed order)
  • Best-case time complexity (already sorted)
  • Average-case time complexity (elements in random order)
code of conduct - report abuse