English 中文(简体)
多读方案拟订的最佳分类法是什么?
原标题:what s the best sorting algorithm for multi-thread programming?

我想打着一阵 in,长度为1 000 000至100 000。 我愿利用校对图书馆使用2Mbcache的核心2duo计算机实施这一方案。 我想最快的算法!

我写了一部半平行的代码,使用混合算法。 但这还不够快!

          ___ sort___   
         /                   
        /____ sort ___     __ merge __
    ___/               \___/           \___ merge 
        ____ sort ____/   \__ merge __/    
                     /      
         \___ sort __/      
问题回答

它是自一上大学以来的一段时期,但似乎忘记了PSRS<>/code>的算法对于此类事情是好的。 我确信,Gonogle将揭示执行/假守则的负担。

快速度使自己处于多面性。

当你分治时,分治是目前read的一方,另一边是新read。

由于你处于核心2duo,我将研究平行的Quicksort算法。 它可以进行内部分类,保存记忆,并能够取得与进程数目成正比的绩效收益,最多可达到少数进程者。

平行快速算法基本上执行分级步骤,然后在左边快速进行,并在单独程序中进行右子。 可以通过在共同的僵局中储存束缚来做到这一点,如果表面上看得更远的话,这最终会成为争论点。

还有一些其他算法,如PSRS,即加工商数量越多,但是,由于你身处核心2duo,这很可能使你在2个真正的核心+2个超凡的岩心上走得最大,PSRS所需的额外记忆很可能是一种浪费。 鉴于你想要打造的内容很多,你很可能需要保存记忆。

I have implemented both in Java on Github. Let me know if you d care to look at the code as a guide to implementing something with pthreads.





相关问题
How do I sort enum members alphabetically in Java?

I have an enum class like the following: public enum Letter { OMEGA_LETTER("Omega"), GAMMA_LETTER("Gamma"), BETA_LETTER("Beta"), ALPHA_LETTER("Alpha"), private final String ...

Grokking Timsort

There s a (relatively) new sort on the block called Timsort. It s been used as Python s list.sort, and is now going to be the new Array.sort in Java 7. There s some documentation and a tiny Wikipedia ...

Sorting twodimensional Array in AS3

So, i have a two-dimensional Array of ID s and vote count - voteArray[i][0] = ID, voteArray[i][1] = vote count I want the top 3 voted items to be displayed in different colors, so i have a 2nd Array -...

Linq operations against a List of Hashtables?

I m working with a set of legacy DAO code that returns an IList, where each Hashtable represents the row of a dynamically executed SQL query. For example, the List might contain the following records/...

C++ Array Sort Me

Stuck on an array sorter. Have to sort numbers from largest to smallest. I m trying two loops (one nested in the other). Here s the code: int counter=0; // inner counter int counter2=0; // outer ...

Can I Nest OrderBy in .NET?

This doesn t seem to work as I intend. VB.NET: Dim x = Model.Discussions.OrderByDescending(Function(d) d.Messages.OrderByDescending(Function(m) m.Sent).First.Sent) For Each d As Discussion In x ....

sorting elements javascript

I m looking for a way to sort my elements, but it isn t as easy as it sounds. Please let me explain My elements are grouped per 6 elements (thumbnails), each x represents a thumbnail However all ...