CodeBus
www.codebus.net
Search
Sign in
Sign up
Hot Search :
Source
embeded
web
remote control
p2p
game
More...
Location :
Home
Search - non recursive quicksort
Main Category
SourceCode
Documents
Books
WEB Code
Develop Tools
Other resource
Sub Category
GUI Develop
Windows Kernel
WinSock-NDIS
Driver Develop
ADO-ODBC
GDI-Bitmap
CSharp
.net
Multimedia Develop
Communication
Shell api
ActiveX/DCOM/ATL
IME Develop
ISAPI-IE
Hook api
Screen saver
DirextX
Process-Thread
Console
File Operate
Printing program
Multi Monitor
DNA
Other
Search - non recursive quicksort - List
[
CSharp
]
QuickSort
DL : 0
快速排序(快速排序)是一种快速排序算法,它被广泛应用于实践。它是用于分而治之的原则。快速排序的工作原理是划分一个给定的数组A [P。 。 R]分成两个非空的子阵列A [页。 。 Q]和A [Q + 1。 。 R]使得在[P每个元素。 。问]是小于或等于每个元素A [Q + 1。 。 R]。然后两个子阵列被递归调用快速排序排序。快速排序的细节描述如下: 1.选择一个支点值(基准)。您可以采取的第一个元素的值 枢轴值,但它可以是任何值,这是在排序的值的范围,即使它不存在于阵列中。 2.分区(划分)。重新排列以这样的方式是比所述枢轴更低所有元素去阵列的左侧部分的元素,并且比枢轴更大所有元素去阵列的右侧部分。值等于枢轴可以留在阵列的任何位置。 3.排序两个子阵列。递归地应用快速排序算法的左侧和所述阵列的右侧部分。编写一个函数模板快速排序下Fig.8.15的排序程序的参考,同时也写输入,排序和输出int数组和一个float数组元素的8潜水员程序-quickSort(快速排序) is a fast sorting algorithm, which is widely applied in practice. It is used on the principle of divide-and-conquer. quickSort works by partitioning a given array A[p . . r] into two non-empty sub-arrays A[p . . q] and A[q+1 . . r] such that every element in A[p . . q] is less than or equal to every element in A[q+1 . . r]. Then the two sub-arrays are sorted by recursive calls to quickSort. The details of quickSort are described as follows: 1. Choose a pivot value(基准). You may take the value of the first element as pivot value, but it can be any value, which is in range of sorted values, even if it doesn t present in the array. 2. Partition(划分). Rearrange elements in such a way that all elements which are lesser than the pivot go to the left part of the array, and all elements greater than the pivot go to the right part of the array. Values equal to the pivot can stay in any position of the array. 3. Sort both sub-arrays. Apply quicksort algorithm recursively to the
Date
: 2025-12-31
Size
: 11kb
User
:
lefter
CodeBus
is one of the largest source code repositories on the Internet!
Contact us :
1999-2046
CodeBus
All Rights Reserved.