Click here to Skip to main content
12,405,700 members (65,076 online)
Click here to Skip to main content

Stats

36.6K views
234 downloads
14 bookmarked
Posted

Iterative Quick Sort

, 25 Jan 2008 CPOL
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
Web02 | 2.8.160721.1 | Last Updated 25 Jan 2008
Article Copyright 2008 by Pete Goodsall
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid