1:快速排序的思想:通过一趟排序对整个元素进行分割,左边的元素都比基数要小,右边的元素都比基数要大,在对左边的元素进行递归,在对右边的元素进行递归,以此使整个元素集变成有序的状态
2:原理图:
3:话不多说,代码奉上:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MathMonoTest : MonoBehaviour {
void Start () {
//基础数据元素 引用类型 ,所以改变了值之后数据也发生了改变
int[] intarray = new int[] { 3, 5, 6, 8, 9, 7, 4, 2, 0, 1 };
QuickMathFunction(intarray