2015년 4월 5일 일요일

Week 12: Last Impressions

          Looking back at the course now, I feel like I can do so much better because I know most of the things. There are things that I have learned after I wrote the midterms or things that I know I have made a mistake right after I hand in my tests.
          When I first learned about recursions and Tree, they were so confusing to me that I could hardly understand the concepts. I still have troubles here and there when writing codes or if the questions are complicated, but I think I understand most of the things. If there is still a thing I find hard, it will be LLNode since I feel like we had such a little time to learn than other things. I'm not sure how the Final Exam is going to be, but if the questions are similar to the midterms, I feel like I can do better than before.
          I just hope that I can do well on the final exam and hopefully the SLOG I've written can help me when I have troubles studying for the exam.

2015년 3월 29일 일요일

Week 11: Revisiting an earlier SLOG posting

          After revisiting week 1 SLOG posting, my opinions have changed on some parts. On week 1 posting, I wrote that I couldn’t understand why computer scientists should know how to write. I only assumed that it could help me recall the things I’ve learned in lecture and tutorials and it could possibly help me with studying midterms and a final test.

          Now that I’m almost done with CSC 148, I think geeks should know how to write. Not only is it similar to coding, but it is also helpful when we are writing hash tags beside our codes to help the readers understand better. When our writing skills have developed, it was easier for us to communicate better with other computer scientists. I think communicating is mandatory for not just computer scientists, but for everyone so everyone should know how to write!

2015년 3월 22일 일요일

Week 10: Impressions of week 9

          In week 9, we learned about BTNode, which stands for Binary Tree Node. Binary Tree only has a maximum of two children per node which means it either has one or two children. We also learned about Binary Search Tree which left child is always smaller than the node and the right child is always bigger than the node.

This is an example of Binary Search Tree.


          That week, we also had a term test, which I found harder than the first term test. The second term test was mostly about recursion, linked list, linked list node, and trees.

2015년 3월 15일 일요일

Week 9: Impressions of week 8

           On week 8, we learned about LinkedList, class LLNode, and class LinkedList. Because I was studying for the midterm, I have read and studied all the slides from week 5 and week 8. To understand better about LinkedList, I watched several videos, and this helped me understand much better. 


This image,

Singly-linked-list.svg

is from the lecture slide, and this is one way to think about linked list structures. 

          We also learned how to append, prepend and delete. 

2015년 3월 8일 일요일

Week 8: Impressions of week7

          This week, there was no lab on Thursday, so I worked on the assignment most of the week. I wish there were a lab on Thursday because that's when I review most of the things I've learned that week. But I still had more time to work on my assignment, so that was a good thing.
          This week, I couldn't attend one of the lectures because I was sick. So I read the lecture slides that were posted on the website. To be honest, I didn't understand most of the things, but from what I read, iteration is used as a loop and the rest looked like a Tree to me since they included nodes.
          I'm not sure if it's because I missed a lecture, or the things we are learning currently is difficult level for me, but either way, I would need to study harder for my term test 2.

2015년 2월 15일 일요일

Week 6: Summary of Object-Oriented Programming Concepts

      This week, we have learned about Object-Oriented Programming. From what I have understood, this works sort of like a family tree. Here are some important terminologies that were useful when doing programming. Node is the parent of the tree which can be distinguished as a root. Then there are the children below Node. Internal node is a node with one or more children. Leaf is a node with no children. Arity states a maximum number of children a node can have.

This is a general tree implementation from the lecture slide:

class Tree: 
      ’’’ Represent a Bare-bones Tree ADT’’’
      def __init__(self, value=None, children=None): 
            ’’’ (Tree, object, list) -> NoneType

            Create Tree(self) with root node value
            and 0 or more children. 

            ’’’ 
            self.value = value 
            # copy children if not None
            self.children = children.copy() else []
            # the functional if on the line above is equivalent to :
            # if not children:
                  #self.children = []
            #else:
                  #self.children = children.copy() 
   
From this class Tree, we can find the height of the tree, find how many leaves, and the arity of the tree T by using def---.

For me, counting leaves were a bit confusing. But I found a way of doing it. If there were a method:

def list_leaves(t):
    ''' (Tree) -> list

    Return a list of values in leaves of t.

    >>> t = Tree(0)
    >>> list_leaves(t)
    [0]
    >>> t = descendents_from_list(Tree(0), [1, 2, 3, 4, 5, 6, 7, 8], 3)
    >>> L = list_leaves(t)
    >>> L.sort() # so list is predictable to compare
    >>> L
    [3, 4, 5, 6, 7, 8]
    '''
I would first look at the arity, which in this case is 3, next to the eight numbers in a list. This means on the top of the list below 0, there will be three numbers. Therefore it'll look like:

0
1          2          3
Then below each '1', '2', and '3', there also will be 3 children.

0
1          2          3
4 5 6     7 8              
Therefore, [3,4,5,6,7,8] will be the leaf because they do not have any children. 

2015년 2월 7일 토요일

Week 5: Impressions of tracing recursion from week 4

On week 4, we learned how to trace recursions. We also got a worksheet in class to practice tracing recursions. From the work sheet, recursions are usually written in this form:

def c(s):
     """ (Docstring omitted)
     """

     return sum ([c(i) for i in s]) if isinstance (s, list) else 1

Which means if there is a list, for example c(["one", 2, 3.5], the isinstance (s, list) will check if s is in a list. If so, the function will use a for loop to go over each element in s with an "i". However, I noticed that in this case, the "i" will be put in a c(i) for every element and in the end, all the elements in the list will refer to the else part of the fuction where in this case, it will return 1. Then the function will find the sum according to how many 1's there will be. I noticed that the faster way to figure out the answer in this case is to count how many elements there are in a list and times it by the number that is in the else part.

Another example of a recursion is:

def sum_list(L):
     """ (Docstring omitted)
     """

     if isinstance (L, list):
          return sum([sum_list(x) for x in L])
     else:
          return L

In this case, it is similar to the example above. However, in the return section, it says return sum([sum_list(x) for x in L]). So when the for loop is running, x will go over each elements in the list L and will be put in a sum_list(x). If this were to be saved as (a, b, c), then in the end, the y will be written sum([a, b, c]) which will produce a+b+c.
Example: sum_list ([4, 1, 8]) ---> sum([sum_list(4), sum_list(1), sum_list(8)])
                                           ---> sum([4, 1, 8])
                                           ---> 13

2015년 1월 31일 토요일

Week 4: Impressions of first few weeks

      At first, before I actually attended the class, I thought CSC148 would be very similar to CSC108, but a bit harder. However, when I attended the first week, I thought it was similar yet very different to CSC108. CSC148 did use things that we have learned in CSC108, but there were also things that I had no idea.
      For example, I didn't quite understand the turtle examples that were used in the lecture. However, when I did some readings that were up in the website, I felt like I had to do the readings that were posted before the lectures. The first few weeks were not very hard, but not easy if I didn't do the readings. The labs were confusing at first, but after two labs I thought I could handle it. The assignment was hard, but I think it helped me understand the lectures better.

2015년 1월 22일 목요일

Week 3: Why geeks need to know how to write

      At first, when I didn't know much about computer science, I thought all you need to know about computer science was the computer itself. However, now it requires not only math, but also some writing skills. For now, I do not completely understand why computer scientists should know how to write, but by assumption, I guess it could help me later on.

      In slog, I can write what I didn't understand, what I understood that I didn't and almost anything that had happened in the lecture and the tutorial. Every week, by writing slogs, I can review what I have learned that week and look back at the lecture slides and ask my friends. I can also read what others have written in their slogs and possibly get some ideas about things I didn't understand. To be honest, when I took CSC108 last semester, I tried to keep up with the notes of what I have learned that day. However, after a month, I got lazy and didn't write the last bits of the notes. Since this is mandatory for everyone, I would have to write it even if I get lazy and this would be up to date every week. I think this slog will be very useful when I'm studying for midterms and a final because I can just re-read what I have wrote and recall things.