2016年3月31日星期四

Week 11 Slog


I am quiet happy with my performance in CSC148 right now. It seems like I have found my ways to deal with the course. I scored around 90% in both tests, which made me so happy, and the recent subjects I learned (Tree and running time) helped me to be even more interested in Computer Science. Hope I can finally get into the major.  
Tree is not a abstract concept for me. As professor usually explain Tree questions with pictures, it is easy to understand. The keys to solve the questions about Tree are paying attention to return type, base case and recursion step. Below is a function I wrote to practice.
def count_interior(t):
“””
Return the number of nodes that are not leaf in t.
“””
Acc = 0
if t.children:
Acc += 1
for child in t.children:
Acc += (count_interior(child))
return Acc

Test 2 was really helpful for applying and reviewing the knowledge I learned during past couple weeks. I read the Notes from the lecture and quiz, did some past tests and discussed some hard questions with my peers. I am pretty satisfied with the final result I got, but, meanwhile, I know I still got a lot of things need to improve. I am still not able to write the codes in the test without hesitation and some marks were deducted for some small mistakes. I think the problem is that I haven’t write enough amount of code by myself. So I am going to put more portion of my time into code writing during my revision for the final exam.
The running time is a little bit abstract for me as it asks me to imagine the steps computer goes through during the execution of code. CSC165 is also talking about running time right now, but the complicated math problem really confused me. I think I still need to practice a lot in order to be familiar with this topic. Hope doing substantial amount of questions can help me understand it quick.
Below is a question about running time that I am working on:
def inorder(t):
if not t:
return []
return (inorder(t.left) + [t.data] + inorder(t.right))   
Solution:
Assume n is the size of t.
inorder visits each node once, perform constant time on each node. As a result , it takes O(n).

This is not a hard question. What I am doing is to understand how it works and to be familiar with what the answers should look like.
Thank you for spending your time to read my slog, have a nice day! 

2016年3月3日星期四

Week 7 Slog Recursion

Everything works fine so far. The recursion is definitely a hard concept to understand which requires some imagination while writing it, but meanwhile the required imagination is what makes recursion interesting. 
TA and Professor are so helpful. While explain the recursion, the Professor trace the function to let us understand how recursion works and I found out that using tracing to explain recursion is really helpful since it turns abstract concepts into concrete imagines. So whenever I encounter some recursion codes that I cannot really understand, I usually trace it. 
While working on recursion by myself, I found out that except using imagination and tracing, understanding the base case, which is when the recursion is going to stop and return something, is fairly important. So when I am writing the recursion code, what I usually do is to spend some time to analyze the function and the design the base cases. 
Below is a example of recursion code that I am working on to practice. 



def count(obj):
‘’’
Count how many items are in the list
‘’’
#Base Case 1
if not obj:
return 0
#Base Case 2
If not isinstance (obj, list):
return 1

              return sum(count(obj[0]), count(obj[1:]))

2016年1月28日星期四

Slog 1.28.2016

CSC148 is definitely harder than CSC108 for me. I took CSC108 online course last semester. The course was well organized and the knowledge was clearly delivered. Whenever I wanted to review the course, I could find the material and work on it. 
However, I found it hard to review CSC148 by myself. Week 1&2 were fine, but the slides I got for week 3 from the course website are kind of difficult to understand. Maybe it was because I could not remain 100% focus on the lecture. I went to lectures on Wednesday from 6pm to 9 pm, which is a little bit too long for me. 
To solve the problem, I am planning to attend to shorter lectures and go to CS help center frequently. Hope these changes can help me to find my way. 
In Addition, the lab is really helpful. If it is possible, I would like to attend 2 labs in one week. The lab gives us chance to work in small groups and practice what we learned from previous lectures. Lab01 really helped me to understand how to design a Class and manage its attributes. Also, TA was so nice and friendly. He kept helping people in the lab. I didn’t really see him stop and rest in those 2 hours in the lab.