哪个排序算法采用的是STL和.NET基础库的默认搜索? [英] Which sorting algorithm is used in stl and .net base library default search?

查看:84
本文介绍了哪个排序算法采用的是STL和.NET基础库的默认搜索?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在正在研究合并排序的imprived版本。我用C ++和C#实现它。然后分别与STL的排序和的Array.sort()算法进行了比较。在C ++中我有一个平等的(有时是更好的)结果。但在C#中,我不得不使用不安全的code使用指针。在这里,性能自动是不是与默认的排序是多少可比性。所以,我想知道 -

1.哪些算法STL和.NET基础类库?(最好带链接)
使用 2.执行不安全codeS具有性能自动问题?
3.对任何测量新算法的性能自动suggessions我?

I am now working on an imprived version of merge sort. I implemented it with C++ and C#. Then compared them with the stl sort and array.sort() algorithm respectively. In C++ I have got an equal (sometimes better) result. But in C#, I had to use unsafe code for using pointers. Here the performence is not that much comparable with default sort. So, I want to know-

1. Which algorithms are used in stl and .net base class library?(Better with links)
2. Do unsafe codes has performence issues?
3. Any suggessions for me regarding measuring the performence of the new algorithm?

推荐答案

.NET使用快速排序(3快速排序的塞奇威克的中位数)的变化

.NET uses a variation of Quicksort (Sedgewick's median of 3 Quicksort).

除非你是在排序方面的专家,我会感到惊讶,如果你能击败内置的排序在很大范围内的数据(包括随机,已经订购和反向有序集)。诉诸不安全code是个好主意......

Unless you are an expert in sorting, I would be surprised if you can beat the built-in Sort over a wide range of data (including random, already ordered and reverse ordered sets). Resorting to unsafe code is usually a bad idea...

这篇关于哪个排序算法采用的是STL和.NET基础库的默认搜索?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆