﻿using System;
using System.Collections.Generic;

namespace _14.QuickSort
{
    class QuickSort
    {
        static void Main()
        {
            int[] arrey = { 5, 2, 1, 3, 8, 4, 7, 9, 6 };

            //int start = 0;
            //int end = arrey.Length - 1;

            //int firstElement = 0;
            //int temp = 0;
            //int theWall = 0;

            //while (start!=arrey.Length)
            //{
            //        int pivot = arrey[end];
            //    if (arrey[start] < pivot)
            //    {
            //        temp = arrey[firstElement];
            //        arrey[firstElement] = arrey[start];
            //        arrey[start] = temp;
            //        start = firstElement;
            //        ++theWall;
            //        ++firstElement;
            //    }
            //    if (arrey[start]==pivot)
            //    {
            //        temp = arrey[theWall];
            //        arrey[theWall] = pivot;
            //        arrey[end] = temp;
            //        start = theWall;
            //        ++firstElement;
            //        ++theWall;
            //    }

            //    ++start;
            //}
            //Console.WriteLine(string.Join(" ",arrey));

        }
    }
}
