posted Nov 25, 2013, 3:37 PM by Samuel Konstantinovich   [ updated Nov 25, 2013, 3:43 PM ]
Goal: Sorting!

You will NOT learn the bubble sort first...

Your assignment is to write a function:
public static void radixsort(int[]data){ 
This accepts an array of integers, and changes it to be sorted (from lowest to highest)

You must use your notes and your google-Fu skills. I just wanted to clarify you need a method that works. 
A good progression to work on is:
a. Get the array to copy into the buckets.
b. Get the buckets to copy into the array.
c. Get the sort to do both a. and b. with different digits. 
d. Get it to do it until the array is sorted. 

You need to be aware of the difference between primitive data types vs objects as parameters:

Parameters in java are always copies of the arguments given. This means that you cannot accidentally change the value of the outside variables.

public void too(int x){ //parameter is x, it is a copy of the argument
  x = x +1;//this changes the parameter (but not the argument)
public void twee(int[] L){  //parameter is L, it stores the address of the array, 
    L[0]=999;              //so the copy has the same effect as the original
    //this says, go to the array L in memory, change the 0'th element to 999.
public void runme(){
     int n = 4;
     int[] M = { 1, 8, 7};

     too(n);//the argument n has a value of 4, this value is copied into the parameter.
     //function call: n, never changes because the 4 inside of x is just a copy of this number

   //the parameter of twee L gets the same value as the argument M
   //since that value is the address, it doesn't matter that the value is a copy. A copy of an address points to the same location: 
   //the array M is talking about the same block of memory as L
   // so L[0] is the same memory location as M[0]