Sunday 5 April 2015

Why Geeks Need to Know How to Write

When a geek starts looking for a job, good writing skills may help him/her get a better job because the first thing an employer looks at is resume. A great resume can show one's personality traits. Good writing skills not only provide you advantage of finding a job, they also help you communicate with people easier. You can express your ideas more clearly if you are good at writing. Geeks don't need to write better articles then professional writers, however basic writing skills are necessary in everyone's life.

Friday 3 April 2015

Object-Oriented Programming

Object-oriented programming is based on objects. Every value in Python is an object. Object can also be something else. For example, if I design a GDP calculating system then I need to have some objects such as 'CPI Intention' or 'Plan Aggregate Expenditures', etc. Objects can also be subclasses of my parent class. We use inheritance to extend a class. Subclasses do some specific task and parent class defines what all subclasses need to do. A subclass may also have its subclass. We are able to make a 'chain' if we need it for our purpose. Separating a huge class into many children would definitely make organization much clear.

Last Impressions

Let us recall what we have learned so far in this course. On the first few weeks, we were learning how to design a class. That was linked to the last chapter in CSC108. We were all quite familiar with it. Then our professor introduced some new things. For example, subclass allowed us to allocate different functions. Recursion was also a very strong tool to let a function run over and over in order to finish its task. It worked perfectly with tree and that was the reason we learned several types of tree. The last few lectures were more theoretical then previous ones. We began to discuss efficiency and some big ideas.

Overall this course is helpful to my future study of computer science.

Sunday 29 March 2015

Go Back to Binary Tree and Recursion

On week 7, I wrote a slog about binary tree and recursion. Now I revisit it and I still agree my thinking at that time. It is true that binary tree gives us a relatively simple way to search a particular element compared to other trees. Maybe I should change "simple" to "efficient" because we learned about efficiency on last week and I think "efficient" is the better word to describe its attribute. Although searching time still depends on the number of elements or nodes(n) a binary tree has, it literally halves the n every time after it finished a comparison. We use lg(n+1) to represent the maximum times to search n nodes.  lg(n+1) is same as log2(n+1). It becomes much smaller than n when n is getting larger. I've learned this in calculus.
Now let's talk about recursion. I feel more comfortable about recursion. I practiced a lot before the second term test. It was not difficult after several times of memorizing. Time I spend practicing is proportional to how fast and how well I write recursive program.

Tuesday 24 March 2015

Week 10

On week 10, we discussed the second assignment. Our professor showed us one minimax solution. It was not so complicated. First, it generates all the game states reachable in one move. Then it finds score by recursion. Finally, it returns -1 times the lowest score. The minimax my group wrote was very similar to that one  and it worked perfectly. However, efficiency was something we needed our minimax to improve. One way to improve the efficiency was to reduce unnecessary call. For example in the game subtract square, if the program already found all available moves for a number once, we can save the result into a dictionary so it needs not to repeat the same process when that number appears again.  We will make it happen on next assignment.

Sunday 15 March 2015

Test 2

On week 9, there was not much new stuff we learned because we had the second term test on Wednesday. On Monday, our professor wrote a function called delete. This function consists several  if statements because it works for binary tree and comparison is required. I personally think this function is advanced. The reason is it took me a long time to just understand the code. In the first look, I was so confused because I couldn't figure out how this function deletes node. It seemed no variable was assigned by new data. But eventually it found the hidden code, it was below the  "else" and new data was from a helper function. That helper function is recursive.
I hope I can learn how to write it shortly.

Linked List

On week 8, linked list were introduced. It is a liner sequence of nodes. This means each node can only connect one node. We also learned two terms - front and back. Front represents the whole linked list and back represents the last node. It seemed to be easier than tree. However, when we started to build some functions like delete_back or append, there were several variables we need to change. For example, front, back, and size should be changed in the function delete_back.
To draw a picture before writing codes is helpful because sometimes people cannot visualize linked list in their heads very well. Instead, if we draw a picture, it would be clear that which variable is going to change and how it would change.