5

I am litle curious about what sorting algorithm is using OrderBy (linq to objects). quicksort? heapsort? introspective sort ?

As i see in MSDN documentation List.Sort is using introspective sort: see: http://msdn.microsoft.com/en-us/library/b0zbh7b6.aspx

Maybe OrderBy use the same?

If we go to order by documetation i don't see much information: http://msdn.microsoft.com/en-us/library/system.linq.enumerable.orderby(v=vs.110).aspx

MetaFight
11.6k3 gold badges47 silver badges75 bronze badges
asked Dec 13, 2013 at 20:41
1
  • Two very related posts on SO here (About LINQ based Sorting) and here (About Array data type sorting) Commented Aug 23, 2017 at 2:17

1 Answer 1

4

Apparently it uses a stable quicksort.

This has been verified using reflector.

See: https://stackoverflow.com/a/2792105/569777

answered Dec 13, 2013 at 20:55
4
  • could be, sadly was ansewered 2 years. As i can see it, the implementation from one version to another version of framework could be different (example: array.sort from fm2 was quicksort and for the fm4.5 is introspective sort ) Commented Dec 13, 2013 at 21:01
  • 2
    Reflector is your friend :) Commented Dec 13, 2013 at 21:02
  • @MetaFight There are also free alternatives, like dotPeek. Commented Dec 13, 2013 at 21:50
  • True. I keep forgetting it isn't free anymore. Commented Dec 13, 2013 at 22:09

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.