Advertisement
Guest User

Untitled

a guest
Apr 1st, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     void radixSort(ArrayList<E> *lista, int base, int numMaxSize){
  2.  
  3.         lista->goToStart();
  4.         LinkedList<E>  listBucket[base];
  5.         for(int j = 0; j!=numMaxSize; j++)
  6.         {
  7.             while(lista->getSize()!=0)
  8.             {
  9.                 int  tmpNum = int(lista->getElement()) /  pow(base,j) ;
  10.                 int tmpPos =  tmpNum % base;
  11.                 listBucket[tmpPos].append(lista->remove());
  12.             }
  13.             for(int i = 0; i!=base; i++)
  14.             {
  15.                while(listBucket[i].getSize()!=0)
  16.                 {
  17.                    lista->append(listBucket[i].remove());
  18.                 }        
  19.             }  
  20.         }  
  21.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement