It's the last week, wow! How time flies. Anyway since this was assignment week once again I focused much of my attention on A3. However, learning about Big Oh was very interesting to me. By incorporating different factors of to the running time, I was able to distinguish between what affects the running time and what does not.
As I reflect on the course, I honestly cannot believe how much I've learned this semester. I've always been a fan of assignments, and I can't believe how many concepts I now feel comfortable with because of them. Just this week while I was working on A3 I had a recursion revelation that helped me distinguish from the human interpretation and CPU interpretation that I wouldn't put much attention to in earlier assignments. I mentioned a couple of weeks ago that you cannot "trust" that the recursion will work, when now I realize that that statement is half true. You have provide a base case and THEN you can trust the recursion. Lines can also be added just before the recursion is done as well, but remember to not think of it always like a CPU recursion. I ran into this problem (thinking of the CPU representation) on the game_descriptions function on A3 until I began thinking of how it is done as a human. I must know enough detail to "trust the computer" and use recursion BEFORE I concatenate to my list (instead of using another helper function). I now know that I must train my mind to think in both interpretations (so I can distinguish between them) so that I can do well on my exam. (Thanks to the TA who helped me last Thursday at BA3195 from 3-4!) What I found most fascinating about the course was how every week builds from the other, and by this week I feel as if everything is starting to fall into place. I remember from the first couple of weeks thinking how hard it was to write our own classes when now that's all we're actually doing! Surely we're not writing them from scratch like we did in the second and third week but we did have to write them in A2 and I know that I wrote plenty of helper functions in A3. And recursion was used over and over again in almost every week after week 3 in order to help build a foundation for the exam (and higher year computer science courses)!
Over the past three months, I've really enjoyed CSC148 and the learning techniques used in computer science. Practice really does make perfect, especially in these type of courses. Thank you for the wonderful experience.
CSC148 SLOG
Sunday, 5 April 2015
Week 9 Impressions
Week 9 had a big emphasis on efficiency with BST nodes. The lab we completed focused on the different ways to put nodes into a tree. One exercise consisted of creating a balanced_delete method to allow the new tree look more like a binary tree. The second exercise was investigating the efficiency of the height and contains methods of trees. While there wasn't a very clear way to approach the question, I learned that the most efficient way to put nodes in a BST tree is with the random module. Without the random module, I was placing nodes in a linear order. While the linear approach is fine when you have a list with a short length, it becomes extremely inefficient when the length of your list is a very large number. It would take a very long time to find a number at the bottom of the tree when using the contains method (as it would go through each node in descending order) and it would take a long time to find the length. However, the random module helped me generate a random node and placed it accordingly to where the node.data was so my tree's height can be shorter and the contains method takes less time finding the node. I felt that this week is the start of the beginning of efficiency with big Oh, and I'm looking forward to learning that.
Week 8 Impressions
During the most part of week 8, I was working on my second assignment. While I did find the minimax strategy confusing at first, I did eventually figure out an algorithm. In addition I completed a TippyGameState class that effectively ran. However, a lot of my attention was diverged from the topic of week 8: linked structures. While I did find the topic confusing at first (the str representation was throwing me off), I eventually got the hang of it with more lab exercises. Linked List Nodes (LLNodes) are essentially similar to BTNodes with the difference on the representation of how you initialize it. Once I got past that detail, the coding is not difficult. However, this week there was no recursion involved in coding, just iterations. This also puts an emphasis on the difference between recursion and iterations which helped me understand the concepts better. Fortunately, this understanding gave me a great benefit on the second midterm for the BTNode and LLNode questions! Can't wait for the next week.
Sunday, 29 March 2015
Week 11: Looking back at previous SLOGs
As I approach the end of the semester, everything in the course is starting to fall together. In week 6 and 7 I was being introduced to recursion on trees, and at the time I would play with the implementation until my code was correct. I wouldn't fully understand why the recursion worked, I would just trust that the function would take care of all the underlining work. However, with more practice on implementing trees in my labs after week 7 and my assignments, I began to thoroughly trace each function in parts first before I put them in list comprehensions. This tracing helped me have a better grasp on what the function is trying to do and which traversal it uses when visiting each root. This week especially has helped me understand recursion as more than calling the function as a list comprehension, as what I tried to emulate when I talked about recursion in my "Week 7 Impressions" blog. By discussing with friends some hints to some of the functions' recursion algorithms for assignment 3, I used helper functions that would trace the main function step by step, which was then added to a set. A3 gave me more experience in writing recursion as separate steps, compared to my class or lab list comprehension examples. While list comprehensions are useful and efficient, it becomes difficult to trace and write on the spot (in my case as a computer science beginner). So from now on, instead of jumping straight to list comprehensions, I will write my code in parts first so that I can understand the recursion, and then try to right the code in a list comprehension if the implementation is easy enough. And when I get comfortable enough with recursion, then I will implement with a list comprehension on the first try.
Sunday, 15 March 2015
Week 7 Impressions
In week 6, we were introduced to the terminology for recursive trees and how to implement these types of functions. Now for week 7, we extended our knowledge of recursive trees and introduced Binary Tree Nodes (BTNodes) and Binary Search Trees (BSTs). This allows you to search for a value more effectively in a logarithmic function. In our labs we also implemented BTNode methods. This lab was the first lab that I began to write 'if' and 'else' statements in one line to make them look like list comprehensions so that the code looks cleaner. I also wanted to allow myself to have more options when writing my code. By having data to represent the left side of the node, the right side of the node and the node itself, I learned that there are three ways we can recursively explore a BST (which are inorder, preorder, and postorder). By learning these three tree traversals, I am now able to examine how a tree is evaluated when it is placed in binary order. I hope to use this recursion material in later weeks and later assignments.
Thursday, 19 February 2015
Week 6 Impressions
The week before reading week had very interesting lectures discussed.We started to discuss the science behind computers and how a computer sees a class as nodes, a path, and with children. In this week I was introduced to new terminology. I started to visualize a class as tree branches that all contain children within their larger branches. This makes it easier to find specific children and apply a function call to it. I found this idea similar to binary searches, where you can shorten your options by specifying you search results. During our Wednesday lecture, we also implemented a more complicated function of recursion than what was presented in previous lectures. We continued these recursion implementations in the lab, however, it definitely felt more challenging than previous weeks. During the break I plan on continuing to study week 6 and do more examples so I can start off week 7 prepared to learn the next topic.
Wednesday, 18 February 2015
Summary on Object-Oriented Programming
As a continuation of CSC108, I have learned much more on object oriented programming and how it can be applied not only on how to create computer classes, but also in everyday life. Throughout object-oriented programming, I've learned about many different ideas, such as classes, attributes, methods and instance variables. Not only was I able to create different classes, but I connected all the different ideas with structure and used the appropriate methods.Take as an example, myself, Amanda D'Errico. If we were to create class Girl, we would need different attributes, such as height, weight, hair colour, and so on. These different attributes will have appropriate names to define the methods for class Girl. Then, we can have myself as an instance. Other ideas that I've learned in the past few weeks are different ADTs, such as Stack. There are many built-in functions to Stack, such as is_empty, push and pop, which all contribute to its class. Stack follows a first in, last out (FILO) property, which I like to picture as a tube with marbles stacked upon another. Another ADT I've learned is Queues, which follows a first in, first out ideology (FIFO), resembling a cafeteria line. Inheriting data types have also played a role in object-oriented programming, as it has shortened my code. Overall, object-oriented programming has helped me expand ideas in computer science and in the rest of the world, and I hope to learn more in the following weeks!
Subscribe to:
Posts (Atom)