Monday, 6 April 2015

last impressions


After csc148 session , I learnt a lot , As to the class itself , I like it pretty much . The most impressive feeling for me is that , that's so great , we can use a more sufficient way to solve the problem , such as the subclass and recursion . This really help a lot , I'm a little bit confused about why we learnt Tree and LLnode , I guess may be in the class later on I can figure it out . What's more the most exciting things in this class is that , finally we can design game , actually in the last term I took csc108 class online courses , but we never have chance to design game , the assignments in csc108 looks like exercises for me , and since it's a online course , I have to figure out the assignment by going to the help centre instead of going to the real classroom to have class . As to this aspect , I enjoy csc148 a lot . Whereas , there are something I do not enjoy , mainly I think though we can learn this stuff in a month , but it take one semester to finish it , I think the summer course is better for this class , I think we need more help for assignments as well .

As to the professors , I have to mention the class I entered at first .I went to many sessions and finally I used to go to the session at Wednesday night , since the 9am class is too early , sometimes , we don't have time to finish the course , and the students from 10am class just rush in ; and the 10 am class has too many students sometimes we cannot find a place to sit , and I have class at 11am therefore many times I leave early before the class is over . For the Wednesday night one , it' s pretty good , and we can have break and ask questions , and sometime we can finish the class earlier . The evening one is Danny's session , it was good . And the morning session is Dianne's session , she is nice as well . I like both of the professors , they help me a lot in the assignments . 

As to the assignment , it's really hard , and I can say that without help , I can only get about 50% . My favourite assignment is assignment 3 and it's about the recursion stuff , I used a easy way to present it at first and then I saw the professor post in Piazza said that I cannot use that way to present it , when I corrected my work I feel really hard and I made a team with my friend , and we did it together .


As to the test , I have to say I don't like it since the score depends on the markers or TA , there are some stuff I write the similar things with my friends , while they return a type dict or str , and they get full marks , and I use str as well , and the comment for me is that it is supposed to be a NoneType . How unfair ! Why I was the person who lose marks and they didn't . And after I hand in the remark form , the strike begins , and I'm pretty sure they didn't remark .

Overall , I like this class , as well as the professors and assignments , though I don't like the way they mark , but I think this marking-system would be much more compliment in the final exam . 

Besides , this is my last slog , thank you for reading my slogs for this term , I guess you are the only person who read the stuff I write , thanks anyway , have a nice day . 


















Wednesday, 1 April 2015

week 11 look back to my previous slogs

Looking back to my previous slogs , I find that my mind changed a little bit , which has a little positive influence on me , I guess slogs may be something helpful .

At first , I learnt something useful in slog , in the earlier several weeks I don't like slogs since I think they are really boring and tedious . But there are several times , I post the things we learned specifically . And the things I had post become part of my cheat sheet , it build the construction of the knowledge , and as to this point I should thanks to wikipedia , which helped me a lot . And even I don't like do the tutorial alone , I can always find something interesting in it . Sometimes I record my daily life in the slog , sometime don't .

However there are something I don't like about slogs , the professor said classmate will comment each other , but actually they don't , sometime I feel like I just keep the slog alone and just to finish the homework . Besides we are marked by slog , which I think it's not very properly , I guess lots of classmates like me just to finish the homework to get the mark , I don't think this is the purpose of how the slog as it was designed . Remember the first week , we read why geek should write , but in my humble opinion , I think there are different kind of geek , and some geek like to write , some are not , we can not use this as a standard to evaluate people .

All in all , keeping a slog has both good and side effect , we should use it wisely to better understand ourself and the blog.

week 10

I 'm really busy with my assignment , essay and test this week .

then I try to do option A  in the assignment 2

I find the minimax we talked in the class is easy to solve , but it's really hard to design .

then I decide to back to the option B 

I figure out 7 functions in 2 days , 

but after that I find that we cannot use a list to trace it , we have to use recursion...

Then I do it over again , 

hope the circumstance will be better next week 

I guess really need the labs and tutorials to help me know the things better in csc

week 9

we have a test in week 9
and still BST
start assignment this week
I choose option B
it is much more easier than the option A

Sunday, 15 March 2015

week 8 BST

this week we learned BT BST and LLNODE
Binary Tree
Binary tree is a tree that has only 2 branches: the left and the right. One or both can be None. If both are None, then it is a leaf. And itself is a datum.

Binary Search Tree
Binary search tree is a tree that is used to search a set of data quickly. Since it is binary, it also contains only 2 branches: the left and the right. the left one is normally the smaller one while the right one is the greater one. This structure saves half of the time to find a number: if the number is greater than the datum, then it searches the right side of the subtree, or it is less, then it searches the left side. Definitely, if it is equal to the datum, then it is the number we need to find.


LLnode
In computer science, a linked list is a data structure consisting of a group of nodes which together represent a sequence. Under the simplest form, each node is composed of a data and a reference (in other words, a link) to the next node in the sequence; more complex variants add additional links. This structure allows for efficient insertion or removal of elements from any position in the sequence.

Sunday, 1 March 2015

Recursion (week 7)

Last week I wrote the note about the o-o design  ,  which are just some basic concepts . But I think that's not good enough , this week I'm going to write something interesting about recursion , and I will write about the ADT next week .

Here comes the first question , what is recursion?
In website Wikipedia , we can find the formal definition has two properties:
1.A simple base case (or cases) 2.A set of rules that reduce all other cases toward the base case
After having 148 class , I grow my own idea about this such that recursion is something that a parameter run in a function  , then a parameter will come from the previous result and continuing run in that previous function , and this work will work infinite time .In a word ,  the parameter will change automatically(after every time calculation ) and work in a same function.

Then you might ask that how it works , it that applicable  ?
Actually recursion is very important in both math and computer science . As in math , people can use recursion to find the rule of the numbers , and it will be easier to define them , mostly people will use formula to define set of recursive numbers, for example , there's 2^n(0<=n<=4, n is integer) for {1,2,4,8,16},there is also lots of recursive numbers that can not be defined by math just like famous Fibonacci numbers . But for this one , we can use the computer language to express it . In computer science , it works similarly , but it takes the advantage that computer can compute automatically and accurate .

You probably think recursion is awesome after read the previous things , well,  let's read a recursion question to have some fun .

def nested_concat(L):
    ’’’(list or str) -> str
    Return L if it’s a str, if L is a (possibly-nested) str return
    concatenation of str elements of L and (possibly-nested) sublists of L.
    Assume: Elements of L are either str or lists with elements that
            satisfy this same assumption.
    # examples omitted!
    ’’’
    if isinstance(L, str):
        return L
    else: # L is a possibly-nested list of str
        return ’’.join([nested_concat(x) for x in L])

trace nested concat([[’how’, [’now’, ’brown’, [’cow’]], ’eh?’]])
     nested_concat([[’how’, [’now’, ’brown’, [’cow’]], ’eh?’]])
        --> ’’.join([nested_concat(x) for x in [[’how’, [’now’, ’brown’, [’cow’]], ’eh?’]]
        --> ’’.join([’how’, ’nowbrowncoweh?’]) # believe docstring for str and possibly-nested

                                               # list of str or possibly-nested...
the answer:
        --> ’hownowbrowncoweh?’
In this question  , I find a special way to solve this kind of  problem is that trying to count the number of brackets will help.

That's the things for this week . Thank you for reading my log .



Cited websites or other materials  :

Sunday, 15 February 2015

review of object oriented design

summary of O-O design :
(1).ID and memory address : .Every value in a Python program is an object and has a (virtual) memory address.You can check this using id, or is (try typing these in a Python interpreter)

(2)what is self in python :
(quoted from the required reading )
Now that we're doing things properly, our method has a docstring that includes a type contract and a brief description that mentions every parameter. If you're wondering why the type contract returns NoneType, it helps to know that this method takes a vanilla new object and adds attributes to it. Also, there's nothing special about the name self for the parameter. We could have used me, you, or ego and Python would have understood this parameter as referring to the new instance of Point in the body of the init method. 

(3)__eq__ , __repr__, __str__ , __init__(several method used in Class)
__eq__: return a boolean 
__repr__:return a string
__str__:return a str
__init__:initialize the Class

(4)ADT (abstract data types)
1.Stack ADT: A stack contains items of various sorts. New items are pushed on to the top of the stack, items may only be removed from the top of the stack. (We say that an item is “popped” from the stack.) It’s a mistake to try to remove an item from an empty stack. We can tell how big a stack is, and what the top item is.

stack function:
a)pop:Remove and return the top item from self.
b)push:Place object o on top of Stack self.
c)is_empty:Return whether the self is empty.

2. Tree:Represent a Bare-bones Tree ADT

Tree function
list_all(t)Return a list of values in t.
list_leaves(t) Return a list of values in leaves of t.
list_interior(t):Return a list of values in interior nodes of t.
list_if(t, p): Return a list of values in Tree t that satisfy p(value)
list_to_depth(t, n):Return a list of values in t from nodes with paths no longer
    than n from root
gather_lists(L): Concatenate all the sublists of L and return the result.
descendent_from_list(t, L, arity):Populate t's descendent from L, filling them
in in level order, with up to arity children per node.
    Then return t.

(5)inheritance: 
upperclass : a general class for a kind of things , we will return NoneType in some method 
subclass: a specific class , we can override upper class, inherit the things we need and complement the things we need 

(6)recursion : call a function over and over again 


example:
(1)
>>> w1 = "words"
>>> w2 = "swords"[1:]
>>> w1 == w2
>>> w1 is w2
False







(6)http://www.cdf.toronto.edu/~csc148h/winter/Labs/lab03/handout.pdf

Friday, 13 February 2015

impressions of tracing recursion

    impressions of tracing recursion 
I understand the recursion ,
it's like an n-time 'while loop'
 I find it's useful and 
what's more ,
we can apply this in a Tree as well 
however , 
I made mistakes in the test about the recursion, 
which means there are some parts I do not understand that well 
Then I review the lab handout  ,
I think I will do it better next time 

Monday, 2 February 2015

the 5th week

this week we are gonna have a test

so

I did some past tests from 2014 ,

Last week we learned about the recursion and i think it's hard to write the brackets correctly
and I still did not figure out the __repr__ and __eq__ stuff , i will go to the office hour after today's class :)

Thursday, 22 January 2015

Why geeks should write

After reading the required reading , I benefit a lot ,especially I prefered the last one (Advice for computer science students ),  I have to say I have thought about the same questions as well . It's a kind of way of thinking  that no matter what kind of subject you are interested , you should learn something you are not good at as well , just to be well-rounded and ,  I think the way that debug it's a phenomenon that reflect you want to do a better job as well . In a word , you should expect more to yourself than others , it's a kind of expectation . That's what I feel , and in the following paragraphs , it's some ideas which I get from the reading.

As to why geeks should write , mostly geeks will use the log to trace their bugs and then fix it out or even find more questions to work on .Some writers recommend the wiki and the blog(tumblr) or Evernote  , the first two (wiki and blog ) are much more public and the last one tends to be private . 

While start to tracing bugs , there are 2  kinds of bugs :
"1.The first is of the form “I think I know where this is” which won’t take long to find. The steps are pretty easy: Figure out how to reproduce it. Set a couple of breakpoints. Add some caveman debugging. Find the problem and fix it.2.The other class of bug is of the form “whoa. Uh… I’m not sure how to even start approaching this problem.” These are the bugs where you know you’re in for a long haul. Maybe it’s one you know is going to be tough to track down because of threading. Maybe it’s an unfamiliar code base."(From Logs for catching bugs ) 

And there are several ways to debug :
1.in the Keep a Debug Journal , there are mainly 3 parts:it is problem , answer and lesson 

2.in the  Logs for catching bugs, it's "With the log you’re building a record, a stream of evidence about the bug. " and then wiki in a document 

And there are some benefit from debugging :
1.By going back and forth between interesting quesions and their answers, I can explore the problem space. (From Logs for catching bugs )

2. This is another tool in your arsenal to solve problems. You may have spent an hour or twelve today struggling with an issue.(Keep a Debug Journal)

3.It’s a simple idea but has the potential to be very effective in saving you time in the future, and helping you to learn too.(Keeping a debugging journal)

4.From  Advice for Computer Science College Students
  1. Learn how to write before graduating.
  2. Learn C before graduating.
  3. Learn microeconomics before graduating.
  4. Don't blow off non-CS classes just because they're boring.
  5. Take programming-intensive courses.
  6. Stop worrying about all the jobs going to India.
  7. No matter what you do, get a good summer internship.

In a word , probably  i will start to use the debugging blog myself since there are so many geek writers that benefit from that :)

Wednesday, 21 January 2015

SLOG 1 the second week csc148

Hi , this is the first time using the blogger 

it's really awesome  that i have a blog website myself !

this week i'm impressed by the subclass (inheritance) part in the class ,

 and i enjoy that a lot ,because we can use that in assignment 1 , 

and I feel a little bit frustrated that our class's process is a little bit slower than Danny's class , 

but i read the required reading part before class ,

 so it's ok for me ,

about the material covered this week,  I feel the stack1 and stack 2 is helpful 

I start to write the assignment last week and i plan to write that on weekend this week 

i didn't ask or answer any question , but i keep an eye on the piazza ,and i find that some post really help me a lot 

finally , it's really a nice week :)

i learned a lot ~