Click here to Skip to main content
11,640,866 members (60,989 online)
Click here to Skip to main content
Add your own
alternative version

Iterative Quick Sort

, 25 Jan 2008 CPOL 33.4K 214 14
An iterative implementation of Quicksort
using System;
using System.Runtime.InteropServices;

namespace IterativeQuickSort
{
    class Stopwatch
    {
        [DllImport("kernel32.dll")]
        extern static short QueryPerformanceCounter(ref long x);

        [DllImport("kernel32.dll")]
        extern static short QueryPerformanceFrequency(ref long x);

        private static double strt;
        public static double time;

        public static void Start()
        {
            long cnt = 0;
            long frq = 0;
            QueryPerformanceCounter(ref cnt);
            QueryPerformanceFrequency(ref frq);
            strt = (double)cnt / (double)frq;
        }

        public static void Stop()
        {
            long cnt = 0;
            long frq = 0;
            QueryPerformanceCounter(ref cnt);
            QueryPerformanceFrequency(ref frq);
            double c = (double)cnt / (double)frq;
            time = (c - strt) * 1000;
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Pete Goodsall
Software Developer
United Kingdom United Kingdom
No Biography provided

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150731.1 | Last Updated 25 Jan 2008
Article Copyright 2008 by Pete Goodsall
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid