2015年4月8日星期三

Week 12

Say something to farewell to CSC148

      A course doesn't mean something when you select it on the ROSI. But, at once you finish it, you

 will appreciate it for teaching so much interesting knowledge and the growth you get in the process. 
      
     Thanks Mr Danny and all the hard-working TAs for arranging the lab and assignments and

solving our questions. You really do a good job no mater with the unexpected strikes.

    Let me talk something about the knowledge about CS I learned in the course.  Without doubt,

recursion is the key point and most useful, challenging knowledge. I dare say it greatly broaden my

minds when confronting with a problem. With this tool, we could take a good advantage of computer

to finish a lot of work with good efficiency.

    Besides, by learning many ADTs(abstract data structure), I am able to model many things in

realise, which reminds me that many real life things could be solved by computer after modeling the.

    Last but not the least, all three assignments really promote  my competence of debugging and urge

me to develop a good habit of programming with restrict format.

   Good-Bye! CSC148. Thanks for making me grow.

2015年3月25日星期三

Week 11

Turn back to see my steps left behind
    At my first slog of 148. I said I does not like any form of writing.  How naive am I? 

    Emotion and attitudes are a reflection of our innermost being. Why don't I not writing? To be 

honest, I do not feel confidence about my writing skills and do not want this become a factor 

affecting my grades. It is just an excuse for me to escape from confronting my weakness. 

    I really need to adjust my mind. Talking and words are really plain to express our feeling exactly.

 But when I typing all of this, my minds are thinking of many things. Introspection is always good 

and let us have a rest to comb our life and adjust the direction of the goal. 

    Life is full of change, calm down and take it. Nothing is not could gonna make it. So, why should 

I  be frustrated? Such a great life, so many helpful friends, caring family, all devoted instructors and 

even the strangers who once smiled towards you.

   I need turn my head and move on.

Week 10

Trace your calls and debug your function
  • Making assertion
  • Trace calls
    This week, we did not learn much but some evaluate and debug method to test your 

code.

    Without question, debugging is so familiar to us ---- a programmer. With the complication 

of the code grows, we always spend lots of time to debug code. Sometimes, you may finish 

the code for 1 hour but debug it for 4 hours.... I still could feel the anxiety when I am stuck 

by a bug. 

    Since, it is so common in programming. We have to learn some systematic methods to 

be applied to fix all bugs in step by step with high efficiency.

    1. Making assertion. Making assertion is actually just let the computer to examine if the code 

output the result as we want rather than need us to print it out and compare it with our expectation. 

The tool is often used in unittest to compare expected result and actual result.

    2. Using the debug tools built int the Wing could also enable us to analyse our code in a visible 

method. We could check whether the variable changes as we want as the code running.

    I seldom complain the experience of debugging. I believe it is also a good exercise for me to 

program in more strictly mind and help me accumulate the experience of fixing different kinds of 

debug problem.

   More you practice, more you learn.

2015年3月15日星期日

Week 9

Know more about Binary Search Tree
  • Efficiency of Binary Search Tree
This week Danny lead us learn more knowledge about BST(Binary Search Tree).

First, we come to discuss of the efficiency of the BST with the initial insert method. 

For example, to an empty BST, if we insert 10 numbers from 1 to 10 with increasing or decreasing order. One of the Tree will be like:
The other one is almost same but with converse numbers. Obviously, the height is so high. The BST does really a bad job to the inserting numbers that have been in ordered before.In other words, to numbers in certain order, BST could not display its special features.

So how we deal with that. By the lab I find we could use random module to change the inserting order of the numbers in a number list. Like this: 

import random
while number_list:
   num = random.choice(number_list)
   number_list.remove(num)
   bst.insert(num)

Although it could fix the problem in some way, it is not a perfect method. We should find the key part of the problem is that out BST could not adjust its existing structures to fit the new inserting number. Hence, we have to optimize the initial insert method.

  I have not come up with some great idea about this. I need to think of it for some days. 

2015年3月8日星期日

Week 8

Linked List - Why you could be so long?
  • Linked List Node
  • Linked List
  Such a busy week because of the assignment 2 which I really put a lot of 

efforts in it. Confronting with tons of different bugs keeping optimizing the 

construction. Although it made me wore out, but I find that my significant

 progress in competence of debugging and the understanding of recursion.

 Here comes to the point. This week ,I learned LLNode and LinkedList. To be

 honest, at first I did not understanding what they are. But then, after 

finishing the practice of lab handout, I find its amazing features.

 At first, LLNode is the composition of a LinkedList. It is a ADT that

contains a value and a successor variable which could be used to point at

another LLNode. Because of the existence of this variable we could link tons

of LLNode together.

 Hence, another class called LinkedList is invented to construct these LLNodes

together with specify its heading(front) and tail(back). Just like a snake 

game, which could keep elongating without limits, which is even more special 

that it could add elements from the front.

 By the way, with creating many methods, we could use it to implement some 

functions like indexing, append, insert and delete...

 There is a very tricky place when we want to insert a LLNode in the LinkedList.

Here is a case that I want to insert a LLNode(2) into the LinkedList that LLNode(1).nxt = LLNode(3)

Firstly I have to change the LLNode(2).nxt = LLNode(3), then I change the 

LLNode(1).nxt = LLNode(2).The key here is that, if you change the LLNode(1).nxt =

LLNode(2) first, we will lose the ability to find LLNode(3). Hence, we should 

use LLNode(2) to aim at LLNode(3) at first then change the LLNode(1).

  I believe, LinkedList must have many other interesting and amazing latent energy.

  More practice, more you will learn.



2015年2月26日星期四

week 7

More recursion in Binary Tree
  • Binary Tree
  • Recursion
  • Abstract Data Type
 This week, we learn “Binary Tree” based on the ordinary ADT "tree" from the last week.

 "Binary Tree" is distinguish from the ordinary tree that every node has none or no more than 2 children which are also distinct from each other, the left children has the value less than its parent node's value and the right children should has the value greater than its parent node's value.
  
  Although at first sight, I think it is not that good but even troublesome when act as a data type to store data . 

  Since, it it works as a data type that used to store things, it has many weaknesses for example it could not guarantee the sequence of a series of numbers and I couldn't find a number by calling its index. However, when it function as a dictionary, it will display its powerful latent energy. For example:
For example, in the Binary Search Tree(BST) like above and a list contain [8,4,9,3,5,10]. If I want to find out whether 10 is in it. I only need one step(by the special property of BST, from 8 I could go straight to the right to the 9 and then to the right side get 10, total 2 steps!) but need 5 steps in the list.

Another example, if I want to find 5, I just need 2 steps(from 8 I could go straight to the left side and then go the right side of 4 which is 5, total 2 steps).But need 4 steps for the list.

With the n the elements it need only about log2(n) steps to find it out,which is much faster than any other data type.

 More you practice,More you will learn.

2015年2月11日星期三

Week 6

Winter is leaving 
&
Reading Week break is coming
  • Tree - A new useful ADT
The last week before Reading Week Break, which I am really looking forward to 
although I still have no girlfriend to celebrate the Valentine's Day(So sad...)

This week, I learn a new abstract data type which is called - Tree. It just looks
like a tree diagram, with some terminologies like root, node, children, edge,
leaf, height, depth etc. The Tree is created with the base of recursion, because 
every node with its children could be thought as a individual tree. 

By this recursion features, we could use it to quickly and efficiently search some information about every elements.

I once heard a concept 'Binary Tree', which seems to be a very useful ADT to 
store information with some features like magnitude or something which could 
greatly facilitate us to search something.

I believe Tree has much more interesting functions and applications, which needs me to explore.

By the way, the Chinese New Year is coming, which is also my sister birth year.
I wish all my family could live a healthy life and everyone could feel the beauty
of life and cherish the people around you.