Week 11
HEY whatsup guys, I'm back. To be honest, I had a really rough week. I just wrote my second term test today and I think that I'm gonna bomb it. No joke. It's just too hard and I have no idea if I can get over 50 this time. I hope that I'll do a lot better in final exam. So finally it has come to week 11. The week's topic is about sorting algorithms and efficiency. Are you guys ready for it?
If I'm not wrong, seven sorting algorithms have been taught in class up to this point. They are: insertion sort, selection sort, bubble sort, quick sort, merge sort and built-in Python sort. All of these sorts have the same function. They are used to sort a collection of object into a certain order. Of course, the collection of object must be 'order-able' or the sorts won't do their job. The difference between these sorts is the run-time, which is the time each sort takes to finish their job. To compare the run-time of these sorts, we often have to look through the code and find the worst case performance, which is also called the big-O run-time complexity. For example, if sort A has a run-time complexity of O(n^2) and sort B has a run-time complexity of O(n). Then we can conclude that sort B is more efficient than sort A. The sorting algorithms that I've mentioned above have different codes and therefore their Big-O may be different. Bubble sort is often seen as an inefficient sorting algorithm because of its O(n^2) time complexity. However, bubble sort can tell us whether the list is sorted. If there's no exchange at all, then that means the list is already sorted. In another hand, merge sort is very efficient because of its unique method of sorting. It recursively divide, sort and recombine the list and it has a O(nlong(n)) time complexity. Nevertheless, the Built-in Python Sort is faster than most sorting algorithms. Probably only a few customized sorting algorithms can beat the Built-in Python sort.
Efficiency and optimization of code is a very important topic in programming. If the efficiency of the program is too low then it might put too much strain on the CPU or RAM and causes the computer to crash. Not everyone has a high spec computer and therefore, efficiency and optimization of code is important. Especially, for video games. If optimization does not exist, then the game won't run smoothly unless the player has a top tier computer built for gaming. Because of optimization, players with different level of computers can play most of the games in the market now. This has proven how important the efficiency and optimization of code is .
To me, I've been thinking to become a video game developer for awhile. And if I do, efficiency and optimization will be something that I'll always in keep in mind. I don't wanna write a game that is only playable in high spec computers. I want everybody to be able to play my game.
So yea, that'll be all. Next week I'll post my last Slog in CSC148. Please check it out.
No comments:
Post a Comment