"Does these sorts algorithms (in Standard Library) use some of advanced sorts approaches, like bubble sort ... in their internal implementations."pic.twitter.com/G2aVVlqKBA
Usually insertion sort writes every element of the array once, though, right?
-
-
I guess you could have a smarter insertion sort that avoids memory writes if the element is already at the right place, though.
-
That's just the standard insertion sort. You go from left to right looking for a pair of elements that are out of order, and when you find one you swap the bigger element left until sorted. No writes if the array is already sorted.
- 3 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.