Lectures:
On Monday, we mainly looked at big O and identifying the big O of certain pieces of code. This was pretty straight-foward. You mainly have to look at how the number of operations performed by the program changes as the size of the input changes.
On Wednesday, we looked at graphing ADTs, map and reduce, and memoization. I did not really understand the part about graphing ADT's so I'm still looking over it. Map and reduce is basically a way to speed up code. Map is used to create a list, and reduce returns a value of that list such of the sum or the number of elements. Memoization is used to improve recursive algorithms by eliminating redundancy.
Final Thoughts:
Overall, I thought this was an alright course, even though I've already learned a lot of the topics before. I really liked learning about inheritance since that seems really useful and I can see myself applying it to a lot of programs. I also liked the recursion section of the course since it taught me how to deal with and identify recursive problems. The first assignment was also a blast to work through since it gave us a chance to apply and try out inheritance. The first week or two was a bit slow, but it eventually got better.
CSC 148 SLOG
Friday, 3 April 2015
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.
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.
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.
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.
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.
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.
Thursday, 19 February 2015
Week 6: Object Oriented Programming
What Is Object Oriented Programming:
Object Oriented Programming, or OOP, is a style of coding. In OOP, as the name suggests, a programmer deals with different objects that they define such as a dice or a card. The programmer decides what attributes these objects have and what these objects can do. A card for example could have different attributes depending on what game it is for. Each class also has methods which determine what the objects of that class can do.
Uses of OOP:
OOP is very useful since it can help save a lot of time when coding. A class can be thought of as a sort of recipe for making objects. Because of this, a programmer can keep referring to it when making objects instead of writing out each attribute for every individual object.
OOP is also a great way of organizing ideas. Without OOP, it would be more difficult to read and analyze code it would be less clear what is going on. With classes, a person can clearly see what each objects represents, what attributes they have, and what they can do.
This style of coding is also helpful in solving very large problems. OOP is thought of as bottom up programming since the programmer starts with the simplest objects then gets more and more broad. For example, you could have a class for a specific card, then a broader class would be a hand of cards, then an even broader class would be the the hands of cards for every player. This makes it easier to approach and code large programs.
Inheritance:
Inheritance is a way to broadly define what each object should have. Abstract classes defines what attributes or methods a subclass of this class must have. For example, one could have an abstract class for dices. In this abstract class one could define an attribute as a list of all the possible values the dice can have and a method where a random value is chosen. Then a class that inherits from this abstract class could be a class for a six-sided dice, or a class for a twenty-sided dice.
Object Oriented Programming, or OOP, is a style of coding. In OOP, as the name suggests, a programmer deals with different objects that they define such as a dice or a card. The programmer decides what attributes these objects have and what these objects can do. A card for example could have different attributes depending on what game it is for. Each class also has methods which determine what the objects of that class can do.
Uses of OOP:
OOP is very useful since it can help save a lot of time when coding. A class can be thought of as a sort of recipe for making objects. Because of this, a programmer can keep referring to it when making objects instead of writing out each attribute for every individual object.
OOP is also a great way of organizing ideas. Without OOP, it would be more difficult to read and analyze code it would be less clear what is going on. With classes, a person can clearly see what each objects represents, what attributes they have, and what they can do.
This style of coding is also helpful in solving very large problems. OOP is thought of as bottom up programming since the programmer starts with the simplest objects then gets more and more broad. For example, you could have a class for a specific card, then a broader class would be a hand of cards, then an even broader class would be the the hands of cards for every player. This makes it easier to approach and code large programs.
Inheritance:
Inheritance is a way to broadly define what each object should have. Abstract classes defines what attributes or methods a subclass of this class must have. For example, one could have an abstract class for dices. In this abstract class one could define an attribute as a list of all the possible values the dice can have and a method where a random value is chosen. Then a class that inherits from this abstract class could be a class for a six-sided dice, or a class for a twenty-sided dice.
Subscribe to:
Posts (Atom)