Data Structures, and why you need to actually learn them
This year, I am taking CIS 300 at Kansas State University. At first, I expected this class to be boring as it was a class on “data structures.” How much more boring could it get? Oooh, studying the differences in implementations between LinkedList and ArrayLists. The first day our professor proved to us just how wrong we were. He showed us two snippets of code:
String results = "";
for(char c: String.toCharArray()) {
results += (char)(c+3);
}
and
StringBuilder results = new StringBuilder();
for(char c: String.toCharArray()) {
results.append((char)(c+3));
}
He then proceeded to convert the entire collection of works by Shakespeare. Method 1 was estimated to take over 21 days by the computer. Method 2 finished in seconds. That caught my attention.
There are several cool data structures and search techniques that I have found awesome throughout this semester.