I want to write a code for Radix Sort based in this way how I made the Quick Sort, how can I do with Radix Sort, can anybady have any idea I have search a lot but I can not find any exactly what I need

#include <iostream>
#include <conio.h>
#include <time.h>
#include <stdlib.h> //srand and rand functions

using namespace std;
void add_random_numbers(long arr[], long b);
void QuickSort(long vektori[], long left, long right);
long const MADH_MAX_VEKTORIT = 110000;

int main()
{
    long random_vector[MADH_MAX_VEKTORIT];
    long vector[] = { 1000, 10000, 15000, 25000, 30000, 45000, 50000, 60000, 75000, 90000, 100000 };
    long num_elem;
    clock_t tn, tp;
    srand(time(NULL));
    cout << "AlgorithmttNumbers_of_emelmentstttTime(s)n";
    cout << "--------tt-------------------tt-------n";
    for (long i = 0; i < 11; i++)
    {
        num_elem = vector[i];
        add_random_numbers(random_vector, num_elem);
        tn = clock();
        QuickSort(random_vector, 0, num_elem);
        tp = clock();
        cout << "Quick   ttt" << num_elem << "ttt" << (tp - tn) / (double)CLOCKS_PER_SEC << endl;
    }
    getchar();
    return 0;
}
void add_random_numbers(long arr[], long b)
{
    for (long i = 0; i < b; i++)
        arr[i] = rand();
}
void QuickSort(long vektori[], long left, long right)
{
    int flag = 1;
    long i, j, k, temp;
    if (left < right)
    {
        i = left;
        j = right + 1;
        k = vektori[left];
        while (flag == 1)
        {
            while (vector[++i]<k &&i <= right);
            while (vector[--j]>k &&j >= left);
            if (i < j)
            {
                temp = vektori[i];
                vector[i] = vector[j];
                vector[j] = temp;
            }
            else flag = 0;
        }
        temp = vector[left];
        vector[left] = vector[j];
        vector[j] = temp;
        QuickSort(vector, left, j - 1);
        QuickSort(vector, j + 1, right);
    }
}

Should not be hard. It resembles hash bucketing where the hash is just subject to a modulus before bucket selection. It has a bit of a string oriented flavor, as binary numbers have bit radix, but I guess the concepts apply: http://en.wikipedia.org/wiki/Radix_sort#An_example

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.