$title =

CST 338 – Week 2

;

$content = [

The second week of CST338 also focused on getting familiar with IntelliJ and coding in Java but had larger workload. I was already pretty comfortable with IntelliJ which helped a lot, but I have the community edition from 2022 which has fewer features. I may have to download a newer version to generate UML diagrams.

Our first “full calorie” assignment was to count the instances of upper case letters A-K in a text document and sort two arrays containing the letters and their counts. While working on the sorting algorithm, I decided to compare the runtimes of three different implementations.

I compared the runtimes of bubble sort with one for loop using recursion vs a standard bubble sort with a nested for loop. For fun I also compared the runtimes of the bubble sort algorithms with count sort.

I was surprised to find that the nested for loop was more efficient than recursion. After a few runs, sorting with recursion usually took twice as long as the nested for loops. Additionally the count sort was especially slow compared to the bubble sort because of the large range of numbers in the array.

Due to the large range between the minimum and maximum values in the array, the count sort has to iterate through many more indexes to sort the array.

The only output where recursion beat the nested for loop; no idea why.

];

$date =

;

$category =

;

$author =

;

$previous =

;