Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void radixSort(ArrayList<E> *lista, int base, int numMaxSize){
- lista->goToStart();
- LinkedList<E> listBucket[base];
- for(int j = 0; j!=numMaxSize; j++)
- {
- while(lista->getSize()!=0)
- {
- int tmpNum = int(lista->getElement()) / pow(base,j) ;
- int tmpPos = tmpNum % base;
- listBucket[tmpPos].append(lista->remove());
- }
- for(int i = 0; i!=base; i++)
- {
- while(listBucket[i].getSize()!=0)
- {
- lista->append(listBucket[i].remove());
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement