c# - Is there any builtin stable sort routine and swap function in .NET? -
is there in-built stable sort routine in .net?
i know c++ has in-built sort routine under "algorithms" std::sort()
. likewise, have use along c#?
also, there in-built swap function in .net?
using "c# stable sort" in google revealed post top result:
is sorting algorithm used .net's `array.sort()` method stable algorithm?
so answer is: enumerable.orderby
stable sort function, not built c#, part of .net framework libraries.
concerning "swap": don't know of prebuilt generic swap function in .net framework, here find implementation in less 10 lines of code:
static void swap<t>(ref t lhs, ref t rhs) { t temp; temp = lhs; lhs = rhs; rhs = temp; }
Comments
Post a Comment