如何使用2个枢轴编写Quicksort [英] How to write Quicksort With 2 Pivots

查看:80
本文介绍了如何使用2个枢轴编写Quicksort的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我很奇怪地写了一个带有2个支点的quicksort.我选择了数组的2个枢轴顶部. a [0]和a [1],但是之后我无法对它们进行排序.您可以帮我写2个枢轴吗?

Hi everyone ,

i coundnt write a quicksort with 2 pivots. i selected 2 pivot top of the array. a[0]and a[1] but after i can not sort with these . Can u help me to write with 2 pivots?

推荐答案

Google可以帮忙-快速搜索带有2个枢轴的快速排序"可以做到: ^ ]
它解释了该算法并提供了Java代码-您应该能够及时将其重新编写为C,以完成作业!
Google can help - a quick search for "quicksort with 2 pivots" gave this: http://gdtoolbox.com/DualPivotQuicksort.pdf[^]
It explains the algorithm and gives code in Java - you should be able to re-work that to C in time to hand in your homework!


这篇关于如何使用2个枢轴编写Quicksort的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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