Friday, 27 March 2015

SLOG Week 11: Looking back at the first SLOG

The very first SLOG dealt with why geeks should learn how to write. I still agree with everything that I stated there. Programmers need to know how to write so that their code is easily understood by others, and so that bugs can be found easier.

Many other SLOGs that I have read from other classmates seem to agree with this basic idea that programmers need to write to communicate their ideas with others and to find bugs quicker. Although, from looking at other SLOGs there are a few things that I found that I feel should be added.
The first is that writing is a good way of keeping track of what you have learned as a programmer. It could be a new way of dealing with a problem, or  how certain pieces of code work, keeping track of that could save a lot of time.
Another thing is that writing the problem down and writing down different ideas or ways of solving the problem can lead to quicker problem solving. Just staring at a problem will not fix it, programmers need to write down their ideas in order to tackle large problems.
Lastly, writing can help with self reflection. Writing down one's strengths and weaknesses allows them to understand what they have to work on and what goals they should have to improve.

Slog Week 10: Impressions of Week 9

Lectures:
There was only one lecture this week since there was a test of Wednesday. In this lecture, we went through some example methods for binary search trees such as insert and deletion. These were a bit harder and took a lot more thinking to understand. This is mainly because of how many if conditions each method had and trying to understand why each if condition had to be there.

Labs:
Still on strike.  I also get a 404 error when I try to open the link to the handout.

Test:
The test was not as bad as I had expected. This is mainly because only one question had recursion in it.

Sunday, 15 March 2015

Slog Week 9: Impressions of Week 8

Lectures:
This week we mainly covered linked lists. Linked lists are another way of storing information. They're kind of like arrays, except they use nodes. Each node contains a value and a reference to the node that goes after it. Linked lists also have a "wrapper" class that keeps track of which node is the first node, which node is the last node, and the total number of nodes in the list. Manipulating linked lists seems pretty difficult as you have to keep track of what each node is pointing at and which node you are at when traversing the list. We went through different example methods dealing with linked lists such as __getitem__, append, and delete_back. In these examples, we had to keep track of what we were changing to make sure that we do not accidentally mess up the list.

Lab:
There were no labs this week due to strike, which was great for me since that means i get to skip Thursday.


Assignment 2:
I spent a lot of time on  this assignment, way too much time. This was mostly because I did not fully understand how Minimax was supposed to work so I could not implement it. I did eventually figure it out, but it took much longer than it should have. Other than that, the rest of the assignment was not too bad. I'm curious to see what we will do to speed up Minimax in assignment 3.

SLOG Week 8: Impressions of Week 7

Lectures:
For lectures this week, we mainly talked about binary trees and binary search trees. Basically, a binary tree is a tree where each node has at most 2 children.  We also learned three ways to traverse a binary tree. The three were preorder, inorder, and postorder. The easiest way to remember them is that in preorder, the middle node is visited first then the left then the right. In inorder, the left node is first, then the middle, then the right. In postorder, the left is first, then right, then middle. The name of the traversal tells you when to visit the middle node and the left is always before the right.

We also learned about a special type of binary tree called a binary search tree. In this tree, each node has a numerical value. The left node always has a lower value and the right node has a larger value.

Overall, these concepts were not too hard to understand. Although coding recursion for things like this sound very difficult to do.

Lab:
During week 7's lab we had a lot of practice working with binary trees and coding recursion using binary trees. This was very good practice in learning how to deal with recursive problems using binary trees. There are some lab exercises that I couldn't finish during the 2 hour lab period that I am planning to work on at home.

Sunday, 1 March 2015

SLOG Week 7: Recursion

Recursion:
Recursion is useful for when someone needs a function that solves a problem by repeating a particular process over and over again for smaller and smaller inputs. The main characteristic of a recursive function is that the function calls itself.

Recursion is great for many reasons. It may be easier for people to understand as recursive functions and are usually shorter and they can make certain functions MUCH easier to code. However, recursion tends to take up more memory as the computer has to keep track of all the function calls and variables.

From what we've learned in class, a good way to start solve a problem that requires a recursive function is to write an if statement for what happens during the simplest case (base case) of a problem, a case where recursion is not needed. Then, the rest of the cases have to be covered afterwards. A good way to do this is to try to think of what needs to be returned when an input that is very simple, but not as simple as the base case, is given.