What is the point of studying sorting, for example, if there are standard functions in programming languages ​​for sorting arrays? Of course, I do not mind studying, just wondering.

PS I read that the sort function in C ++, for example, determines the dimension of the array and decides for itself what kind of sorting to use in O (n ^ 2), for example, on small input data or O (n * logn) on large

  • In the development of algorithmic thinking. - avp
  • one
    In that different sorts can be used for different input data. In some cases, bubble sorting can be much faster than quick sort (for example, if the data is several tens of megabytes, memory is bleak, and the data is almost sorted (2-3 elements are not in their places). - KoVadim
  • For example, to understand what your standard sorting does, and what the worst case may be. - VladD
  • > Of course, I do not mind studying so thank you so much. And then we were scared - DreamChild

2 answers 2

Do you know what stable sorting is? When the lack of stability can ruin your life? How is the sorting implemented in your library function? Does it have a stability property?
Do you know how to estimate how quickly your data will be sorted?
Do you know that sorting numbers or short strings can be much faster if you use the necessary sorting algorithm?
Do you know how to parallel sorting on several streams and how much power can be extracted from this? Is your library function able to sort into multiple streams?

This is just an example of questions that should be able to answer. And for this you need to understand how the various sorting algorithms are arranged. Well, in general, this is the part of the knowledge of the algorithms, which is quite basic and gives a lot of concepts and knowledge necessary for any programmer.

UPD: I think this article will help you find the answer to all your questions.

  • What is sorting stability? ^^ - Nikolai Kim
  • ... and to understand what stable sorting is :-P - VladD
  • @VladD, please explain in two words :) - Nikolai Kim
  • See UPD - system29a

The effectiveness of the sorting algorithm in a particular case depends on the specifics of the data. Knowledge of the principle of operation will help to choose a more appropriate sorting for a specific task, even if it is a standard one from a programming language.