Saturday, March 22, 2014
5th Six Weeks
This six weeks we began our first investigation of programming algorithms as opposed to language structure and Java idioms. Searching and sorting are very important concepts in any programming environment, and I enjoyed learning how they worked. I particularly enjoyed implementing the quick sort algorithm from a description on Wikipedia and seeing it compete favorably with Java's Arrays.sort() method. However, copying pseudocode into Java does not engender learning, and I am still somewhat shaky as to the exact implementation specifics of the quick sort algorithm. While Wikipedia does a good job of giving an overview of how an algorithm works, it does a poor job of explaining exactly how each part of an algorithm functions, and how an algorithm might be modified. While this lack of detail was not a major problem for the relatively simple quick sort algorithm, it did prevent Ben and I from implementing the much more convoluted merge sort algorithm. I went over the general description of this algorithm in many different sources, but none of them gave enough detail for me to figure out an implementation for myself. In addition, while I had been able to copy and translate almost line for line the quick sort pseudocode, the heap sort pseudocode was far beyond me. The only way I could possibly understand how to implement merge sort was to find Java code and spend time reasoning through it. The problem is that pseudocode is just too brief to be a complete description of an algorithm. I think that a better method would be to include with the pseudocode a line by line description of exactly what that line does, and how it connects to the rest of the program. Through such an explanation, I could get a much more complete understanding of algorithms. This is similar to what Mr. Stephens provides in class when he describes algorithms. However, it would be useful for it to be written down for convoluted algorithms such as the sorting algorithms I have described.
Subscribe to:
Posts (Atom)