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.
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.
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.
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.
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.
Friday, 27 February 2015
Binary Tree
On week 7, professor Denny introduced binary tree. Each node in binary tree has two subtrees (left subtree and right subtree), or no subtree. Moreover, binary tree can represent a binary arithmetic expression because of its property. The definition of binary tree is that data in left subtree are always then than node's data. Similarly, data in the right is bigger than node's data. This gives us a relatively simple way to search. Sometimes we can avoid checking each subtree by comparing data. This saves us a lot of time.
I wrote some functions related to binary tree in this week's lab. All of them required recursion. It was not quite easy to write a recursion line because sometimes the idea was not very clear. It was even harder to express in form of code. To fully understand how to use recursion, I must practise a lot.
I wrote some functions related to binary tree in this week's lab. All of them required recursion. It was not quite easy to write a recursion line because sometimes the idea was not very clear. It was even harder to express in form of code. To fully understand how to use recursion, I must practise a lot.
Wednesday, 3 December 2014
Countable and Uncountable
On week 9, we learned how to determine whether a set is countable or uncountable. A set is countable if and only if it is listable. For example, rational numbers are countable because they can be listed. Also, the number of elements that a countable set has is no larger than the size of natural numbers. Interesting enough, the size of even natural numbers is equal to the size of natural numbers. However, the size of real numbers between 0 and 1 is beyond the size of natural number. No matter how you list them, I can find a number that does not appear on your list. This means that the real numbers between 0 and 1 are not listable, therefore they are uncountable.
Computable and Non-Computable
There was a fall break on week 11, so we had only 2 lectures on that week. We learned the difference between computable and non-computable. If f is a well-defined function and we cannot compute f(x), then f is non-computable. Otherwise it is computable. Also, we can use reduction to prove a function non-computable.
Big-Omega and Theta
On week 10, our professor introduced big-Omega and theta. We tried to solve more complicated examples. For instance, ∀f, g ∈ F, f ∈ O(g) => g ∈ Ω (f) is a typical implication about big-Oh and big-Omega. When the proof is getting longer, the structure becomes very important. The steps we write should be clear and every line needs to be explain in detail.
Subscribe to:
Posts (Atom)