Hi folks,
This post based on my readings in .Net 4.0 beta 1, one of the new enhancements in .Net 4.0 is SortedSet<T> collection type, which implements red-black sorting algorithm with complexity O(log n) for the entire list.
Red-Black tree is an efficient sorting algorithm and using this collection will help alot from performance of sorting large sets in the run time.
C# code:
var mySet=new SortedSet <int>() {3,2,7,23,12,879,345,122,98};
foreach(int x in mySet)
{
Console.WriteLine(x);
}
// output: sorted list.
To read more about .Net 4.0 enhancements, kindly check below links:
http://blogs.msdn.com/bclteam/archive/2009/05/22/what-s-new-in-the-bcl-in-net-4-beta-1-justin-van-patten.aspx
http://msdn.microsoft.com/en-us/netframework/dd819232.aspx
Hope this helps.
Regards,
Mostafa arafa
2 comments:
nice post man :)
Thanks, and appreciate your tip for accept the blog < > operators.
Post a Comment