Advertisement

09.09.2006 at 11:35PM PDT, ID: 21983904
[x]
Attachment Details

radixsort - put counter to count no. of times major operations are performed

Asked by nwhan in C++ Builder

Tags:

following is the implementation of radix sort:-

//----------------------------------------------------------------------------------------------
void radixsort(long data[],int n)
{
      register int i, j, k, factor;
      const int radix=10;
      const int digits=10;      //the maximum number of digits for a long
      Queue<long> queues[radix];      //integer;
      for(i=0, factor=1; i<digits; factor *=radix, i++)
      {
            for(j=0; j<n; j++)
                  queues[(data[j]/factor)%radix].enqueue(data[j]);
            for(j=k=0; j<radix; j++)
                  while(!queues[j].empty())
                        data[k++]=queues[j].dequeue();
      }
}
//----------------------------------------------------------------------------------------------


how can i add a counter in the coding to count the number of times major operations are performed in the algorithm? can somebody please help with that?
thanks....

Start Free Trial
 
Keywords: radixsort - put counter to count no. …
 
Loading Advertisement...
 
[+][-]09.10.2006 at 12:39PM PDT, ID: 17490436

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: C++ Builder
Tags: radixsort
Sign Up Now!
Solution Provided By: JoseParrot
Participating Experts: 1
Solution Grade: A
 
 
[+][-]10.02.2006 at 01:54PM PDT, ID: 17646848

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]10.06.2006 at 09:40AM PDT, ID: 17677914

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32