Wednesday, 30 March 2016
Slog Views: Lets Reflect
It has been 3 months since I began blogging and today, unlike my other slog entries I am going to take this time to revisit an earlier slog and reflect. My most recent slog 'The Puzzle Solver' has already 6 views. In the 'The Puzzle Solver' entry I discussed about the computer science assignment I submitted last week and how I approached it. Writing that entry allowed me to express how I was thinking and how I managed to complete this challenging project. I think its important as a computer scientist to explain to others how and why you tackled a problem. Its also important to include why your solution was a good idea. Based on my views (6) I am somewhat impressed. I would have never expected such attention and because of that I am truly grateful. I appreciate those that take there time in reading my slog. The last time I checked the views for 'The Puzzle Solver' was 3. Therefore, I am proud to say that my views are increasing. I also made sure not to include my own page views in the page view count on the statistics page. It wouldn't be fair to say that I had many views when most of them are me. Because of this increase in views, I believe people are becoming more interested with computer science and hope to see what I learn in this class. I also think its because the assignment was interesting and exciting. In addition to this, I also have a total of 83 views for the past three months of blogging. I really hope that you readers are beneficiating from my weekly posts and learn something new.
Wednesday, 23 March 2016
The Puzzle Solver
I recently submitted Assignment 2. As I previously stated, in this particular assignment we were asked to implement some classes so that we could solve four puzzles: Sudoku, Peg Solitaire, MN Puzzle and Word Ladder. Similarly to assignment 1 the professor provided a starter code and it was my responsibility to complete it.There were many methods that needed to be implemented such as extentions, is_solved , fail_fast and many more.
To tackle this assignment, I first had to understand the rules and purpose of each game. Once I built enough confidence, I thought: How could my program solve these puzzles? The only solution that crossed my mind was if the program explored all of the different possible game moves from a given board. From those possible game moves, the program would then explore the possible moves of these and so on. With this idea, a tree needed to be built. The children for a 'current board' would be all the possible moves that the computer could make from that current board. This would continue until the answer is found. The methods depth search and breadth search especially helped in this area. These searches simply use recursion to search for the solution in the tree. It was very important for me to implement extensions and is_solved correctly for each puzzle. The searches use these methods to access and return the solution in the tree. Method extensions returns a list of children of a given puzzle and is_solved simply returns whether a current board is solved.
Personally, I enjoyed this assignment much better than the first. This is because it dealt with puzzles which I personally enjoy and was less confusing. I was able to see the connections between all methods immediately in the starter code and hence made it much easier to complete.
To tackle this assignment, I first had to understand the rules and purpose of each game. Once I built enough confidence, I thought: How could my program solve these puzzles? The only solution that crossed my mind was if the program explored all of the different possible game moves from a given board. From those possible game moves, the program would then explore the possible moves of these and so on. With this idea, a tree needed to be built. The children for a 'current board' would be all the possible moves that the computer could make from that current board. This would continue until the answer is found. The methods depth search and breadth search especially helped in this area. These searches simply use recursion to search for the solution in the tree. It was very important for me to implement extensions and is_solved correctly for each puzzle. The searches use these methods to access and return the solution in the tree. Method extensions returns a list of children of a given puzzle and is_solved simply returns whether a current board is solved.
Personally, I enjoyed this assignment much better than the first. This is because it dealt with puzzles which I personally enjoy and was less confusing. I was able to see the connections between all methods immediately in the starter code and hence made it much easier to complete.
Wednesday, 16 March 2016
Test # 2
I had my computer science test this week. The test was not extremely difficult and it asked questions that I was expecting. The test consists of recursion, binary trees, regular tress and linked lists. I studied very hard on linked lists, recursion and regular tress but binary trees, I could have studied more. Despite this, I feel that I performed alright on the exam and am eager to see my mark. In addition, the computer science assignment is due next week. In the assignment we are asked to create a program that solves four puzzles: Sudoku, peg solitaire, word ladder and MN puzzle. This assignment sounds really cool and I am pretty excited to start. I will have a more deeper discussion on how I will tackle this assignment in my next slog. As of lecture material we haven't learned anything new since I have mentioned, the test is this week.
Thursday, 10 March 2016
It Just Got More Complicated: Trees, Linked Lists and Recursion
Previously, I have been introduced to recursion and learnt about linked lists. During this week, we talked about trees and how they can be created in python by using linked lists. The tree can then be accessed and tweaked with methods that use recursion. This topic is very challenging for me. I understand and have done many examples on linked lists, but recursion is something that I need to work on. As we go through more challenging and complicated functions that require recursion, I become confused and overwhelmed. For instance, the quiz I had today was asking to implement a function that counted the number of nodes in a tree. I am confident that I implemented the base case correctly, but when it came to the recursive step it became difficult. I became even more frustrated afterwards while I was walking home. This is mainly because I suddenly knew the answer and realized my foolish mistake near the end of my code. To prevent this, I am going to do many examples tomorrow and test them thoroughly. Sometimes when I am asked about a confusing topic I forget to look over my work and I just hand it in. That cost me today. I also know that my midterm for csc148 is next week and I will ensure that I don't repeat this mistake. As I previously mentioned I will do many examples and practice! Practicing is the only way I can do better and develop the skills that I need to become a good programmer.
Thursday, 3 March 2016
Recursion
This
week I learned about recursion. Recursion is a technique that allows a function
to call itself and can be a pretty powerful and useful tool. For example, you can use recursion when finding the factorial
of a number, as shown in the following:
Fact(n)
if n==1:return 1
else:
return n x Fact(n-1)
In
this example, the Fact function is calling itself and calculating the factorial of n
by breaking down the task to two steps.
Recursion takes a task and breaks it into smaller pieces that
are more manageable. I find this technique very interesting and am excited to
do more practice on recursive functions. With such a powerful tool I think that
it is important to use such a technique wisely. Currently I am still wondering which cases
recursion should be used and when it should be dismissed. The reason I ask is because recursion is very elegant but can sometimes be inefficient. For instance, recursive sequences store lots
of data and take time. I believe that as a computer scientist it is crucial
for one to understand when such a powerful tool is needed and when it is unnecessary. It is important to develop these skills so that you can write a simple yet efficient program. Hopefully I can have these questions answered when I ask my T.A and professor this week.
Wednesday, 24 February 2016
Computer Simulation
Reading week just ended and I have just submitted my first assignment. This assignment is about creating a simulation that mimics a ride sharing service. This computer simulation is very much like the subway, taxis and Uber in the real world. To do this assignment, my professor provided a starter code and it is was my job to complete it, running the simulation successfully. I had to read, understand, design and implement several interacting classes. Some of these interacting classes included Class Rider, Class Driver, Class Monitor and many more. It is very exciting to work on a project that can be used in real life applications. Computer simulations are very useful when exploring about 'what if' questions, without actually experimenting it in the real world. I feel pretty good about this assignment and eager to see my grade.
As a follow up, the course coordinator has replied to my concern about having to be introduced to new topics in class and then tested about it the next day(ie. in lab Quiz). He too understands this issue and said that he would talk with the other instructors to see if this can be resolved.
As a follow up, the course coordinator has replied to my concern about having to be introduced to new topics in class and then tested about it the next day(ie. in lab Quiz). He too understands this issue and said that he would talk with the other instructors to see if this can be resolved.
Wednesday, 10 February 2016
It's About Time
Just yesterday my professor taught us about linked lists. For me, this was a challenging concept to grasp since linked lists are very different from the typical python lists that I dealt with all the time. Compared to python lists, the elements in linked lists (nodes) can't be accessed with the use of indices. Because of this it can be fairly confusing. I'm going to try drawing pictures and charts to help me understand. I'll also ask more questions to the T.A. The only issue that I would like to address is that after my class, I have a lab the next day. And in each lab we have a quiz. I have no time to study let alone practice examples for the topics taught in class. It is very frustrating and I will address this issue to the course coordinator. I don't think it's fair to be introduced to a topic and then expected to fully understand the material and be quizzed. I hope the course coordinator understands and finds a way to fix this problem once and for all.
Tuesday, 2 February 2016
Experience so far
In class today we reviewed more on classes. I learned more about super and subclasses and how to implement them. Since topics are becoming more complex and harder to follow, it is crucial for me to practice as much as possible on my own. Before, I just understood the concepts and was able to get away without practicing. My professor consistently emphasis the importance of practicing, and now I can see why. A project specification may look very easy to achieve, but really there are many obstacles and factors that you, as the designer need to consider. For instance, a good designer would want to come up with the simplest yet most efficient program that satisfies a specification . This also means that you as the designer should aim to minimize duplicated code. There are many other things that you need to think of like " what data types should I use?", "how and what is the best way to do this?" . The answers to these questions aren't easy. Practicing is the only way for you to think like a computer scientist.
Wednesday, 27 January 2016
Initial Thoughts
It has
been three weeks since I have started CSC148 at the University of Toronto and I’m
enjoying it so far. I have learnt several new topics during the last few weeks including
how to create abstract data types, special methods and techniques on program
design. I have learnt that following the design recipe as a computer scientist
is crucial. The design recipe provides a clear guideline when planning a program
and encourages me to think more efficiently. During these few weeks I have the
initial impression that CSC148 will be more complex and challenging than CSC108.
I am now taking the foundations of the Python language and applying it to real life
situations. For instance, this week I have learnt the technique of creating super-classes
and sub-classes. To me, this technique emphasizes the importance of design.
There is always a more efficient way to satisfy a specification. Nevertheless, these
challenges make learning computer science more exciting for me. I have the
impression that CSC148 will give me an idea of how computer science deals with
real life applications. My goal in this blog is to share my experiences for
those that enjoy computer science or to anyone who may consider taking any
computer science courses in the future.
Subscribe to:
Posts (Atom)