Thursday, 24 March 2016

Week 10!

This week we talked about how efficient various algorithms were. It is surprising to see how much faster certain algorithms are in comparison to others. For example, when it comes to a very large list, binary search is significantly faster, due to the fact that it is sorted and this the amount of elements to look through becomes smaller each time as you pinpoint the location of the element. We also talked about the various sorting algorithms and the pros and cons of each. I feel like this is a very important topic because in the real word, a program should use the most efficient route to achieve a goal. In assignment 2, I noticed we were told to make our program solve the puzzles the most efficient and fastest way. Through the assignment, I learned how to make programs more efficient, and also how to decide which algorithms to implement so that the search method goes through the shortest possible route

Thursday, 17 March 2016

Week 9

The midterm is over! I am actually a bit scared for this one because I feel like I blanked out on the test. The questions were fairly easy (except 1) and I really regret not taking the time to relax and calm down during the test to put myself together. Luckily my better midterm will be worth 16% while the worse one is 8%! I did very well on the first one so that alleviates a lot of pressure. This week we are further exploring binary search trees. BSTs are somewhat complicated but also very interesting. Hopefully by the end of the course I will be able to use them effectively!

Week 8

This week we looked at binary trees and traversing. It was confusing at the start but I went home and revised and after a few practice examples, I think I have the hang of it. Next week is the midterm so I will definitely make sure I know binary trees inside out because it will be on the test for sure. I spent most of this week working on other courses and as a result, did not get a chance to start Assignment 2. I am looking to start it after the midterm so that I can give it my full attention. I'm a bit scared for this upcoming midterm because it will include recursion. Although I have grasped the concept, it sometimes takes me a while to find a way to implement a recursive function. Hopefully this will improve with practice!

Thursday, 3 March 2016

Week 7!

In class, we have spent a good amount of time doing recursion and looking at examples where recursion makes things easier.Recursion is the process using a function inside itself. A recursive function usually takes form of a function that contains an if statement, and if the condition is true, it calls on the itself with a different parameter. If it is false, the function returns a value. That way, the recursive repeats itself until the parameter does not satisfy the condition.Basically, to sum it all up, there is a base case and the function will repeatedly call itself until the base case is satisfied. It will then go back words and complete the previous calls on itself until the original function call is done. We have seen an example about going through nested lists. In the example,the if condition consisted of checking if the type of an object is a list. If that condition is true, the function is called on each element of the list. If it is false, it returns the value of the object. I believe the key to fully understanding recursion is to know how to trace a recursive function. Once you have that down, it becomes fairly straight-forward. Prof. Danny said that recursion will become very important in this course so I am going to try and know all that there is to this interesting concept.