Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void radx(int *t,int n )
- {
- list * tmp, *temp; //the queue management
- int exp = 10;
- int k, j = 0 , l=1;
- int max = maxi(t,n);
- for(int i=0; i=max*10/exp; i++)
- {
- //insertion to queue
- for(int i =0 ; i<n; i++)
- {
- k = ((t[i]%exp)/l); //digit of our position
- if(head[k] == NULL)
- {
- head[k] = new list;
- head[k]->key = t[i];
- head[k]->next = NULL;
- }
- else
- {
- tmp = head[k];
- tmp->next;
- while (tmp->next)
- {
- tmp = tmp->next;
- }
- ptr[k] = new list;
- ptr[k] -> key = t[i];
- tmp->next = ptr[k];
- ptr[k]->next = NULL;
- }
- }
- //remove and writeback at table
- for(int i= 0; i<10; i++)
- {
- tmp = head[i];
- while(tmp)
- {
- t[j] = tmp->key;
- temp = tmp;
- tmp = tmp->next;
- delete temp;
- j++;
- }
- head[i] = NULL;
- }
- exp *= 10; //next position of number
- l *= 10;
- j = 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment