Wednesday, October 14, 2015

3rd Week of Getting Hip

1. One big thing we learned this week was sorting methods in Java. We learned insertion, bubble, and selection. I have decided to use bubble for my homework assignment this week. Below is how to start the code for a bubble selection sorting method.
public static void bubbleSort (int[] data)
{
    for (int i = data.length - 1; i >= 0; i--)
    {
        // bubble up
        for (int j = 0; j <= i - 1; j++)
        {
            if (data[j] > data[j + 1])
                swap(data, j, j + 1);
        }
    }
}


2. I'm not really using my skills in school yet but I will definitely utilize
them next trimester in my computer science class.

No comments:

Post a Comment