CST 370 Algorithm - Week 4
This week, the main focus is on the Mid-term exam, so there is no programming assignment. However, we do get introduced to Merge-Sort, an algorithm that uses divide-and-conquer technique. While studying the material, I think about the tradeoff or pros and cons of different algorithms. I am currently working on a video game that I will use as Capstone Project, and the aspect of tradeoff is something I have to think of all the time (just like with algorithm)
The very first step of solving any problem is brute force technique. That is, the simplest way possible from the beginning. Why though? Because the brute force is the basic and its advantage is simplification. Moreover, why complicate the approach when you can solve it with the simple way? And that brings another advantage: sanity checking and readable code.
However, people are mostly impatient and don't want to wait too long, so they prefer the algorithm to run fast. Of course, the tradeoff is the programmers have to suffer. Either they have to developer a fast algorithm, or they need to tradeoff in other elements. Taking my video game project as an example. In order to achieve a fast-searching algorithm to find user's desire resource, I have to split resources into multiple containers, under different categories. In addition, I need to check the categories before proceeding with the correct container. As the tradeoff for code maintenance and my effort to craft the structure, the result is a fast algorithm just as I, and users, desire.
There are many more aspects when considering the approach (or algorithm) to solve any programming problem. The more I study, the more I work on my project, the more I learn the valuable lesson: speed is not always the primary key.
Comments
Post a Comment