Sort Quick Sort (1~10)

Source: Internet
Author: User

Now there are fewer students in handwritten order, but in some subjects, the use of handwritten sort may make the topic more simple. Below I will upload some sort of template.

Quick Sort

Basic ideas I will not elaborate, recommend everyone to Baidu (do not understand the words can ask me), the following attached to this Konjac Konjac code.

#include <iostream>#include<cstdio>#include<cmath>#include<cstring>#include<algorithm>using namespacestd;inta[101],n;voidQuicksortintXinty) {    inti=x,j=y; intk=A[x]; if(i>=j)return;  while(i<j) { while(i<j&&a[j]>k) J--; if(i<j) {A[i]=A[j]; I++; }         while(i<j&&a[i]<=k) I++; if(i<j) {A[j]=A[i]; J--; }} A[i]=K; Quicksort (X,i-1); Quicksort (i+1, y);}intMain () { for(intI=1; i<=Ten; i++) Cin>>A[i]; Quicksort (1,Ten);  for(intI=1; i<=Ten; i++) cout<<a[i]<<" "; return 0;}

Xuan Shes

My blog: http://www.cnblogs.com/zbyrainbow/

This article is copyright to the author and the blog Park, Welcome to reprint, but without the consent of the author must retain this paragraph, and in the article page obvious location to the original link, otherwise reserves the right to pursue legal responsibility.

Sort Quick Sort (1~10)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.