The Sorting Algorithm Demo (1.1)


Bi-Directional
BubbleSort O(n2)
alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason."Your browser is completely ignoring the <APPLET> tag!
BidirBubbleSort O(n2)
alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason."Your browser is completely ignoring the <APPLET> tag!
Quick Sort O(nlog2n)
alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason."Your browser is completely ignoring the <APPLET> tag!


一般来说,排序在普通情况下理想的时间复杂度为O(nlog2n),如果需要从50个无序数字中选出由小到大第30个数字,一般做法是先排序,再找出第30个.那么理想的时间复杂度为O(nlog2n). 能再快点吗? 下面给出实现办法,前提就是在不排序的情况下选择.


自己改写的,具体算法和上面的类似.QuickSort
alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason."Your browser is completely ignoring the <APPLET> tag!

The Sources

The applet.(改写过)
The "generic" sorting algorithm.
The Bi-directional Bubble Sort algorithm.
The Bubble Sort algorithm.
The Quick Sort algorithm.
快速选择.
快速排序.