Sunday, March 30, 2014

Week 11 - March 24

The two new sorting algorithms I have encountered are "Quick" sort and "Merge" sort. Since I already learnt recursion, I guess these algorithms would make more sense now than before. This week was all about the efficiency of sorting algorithms in worst case (Big-Oh). 

Both Quick sort and Merge sort use recursion, which is what makes them faster compared to other sorting algorithms. Quick sort partitions the array into to parts with respect to a pivot and sorts these partitions separately. It keeps doing this process recursively and then finally combines all the partitioned arrays together. This algorithm is said to have O(n^2) complexity which is not really close to a linear complexity (linear complexity is the best efficiency one can have). Merge sort is similar but instead it keeps dividing the array into n sub-arrays with only 1 element in it. Then it recursively merges the n sub-arrays in order. This algorithm is said to have O(nlogn) complexity which is close to linear complexity, and hence it is very efficient. 

I think that learning about the complexities of algorithms is a very important topic in computer science because we (humans) want everything to be done as fast as possible. Humans hate waiting! The faster the program, the more incentive it creates for others to use it! This is a really fun topic and this week's lab was the easiest lab of all the labs. However I am still getting used to this Big-Oh notation and it's kind of complicated to understand. 

Sunday, March 23, 2014

Week 10 - March 17th

Back to sorting this week! Memories from CSC108 came back to life as we talked about sorting algorithms this week. This was a very easy week because I find sorting to be pretty simple. However the assignment 2 has been bothering me for a while. It took me around 3 hours figuring out an algorithm for the 'is_regex' function. I implemented it, it seemed to be working, but only the TAs can tell me that! Let's hope it works all good! However the lab exercise for this week was not related to sorting at all! It had to do with trees again. I would say that this week's lab was probably the most hardest lab out of all the labs. I really need to work on trees. 

Sunday, March 16, 2014

Week 9 - March 10th

This week covered more binary trees. I found it surprising that the things we do in first year actually has real life use to it. For example, binary trees are used by Google. That makes me feel a lot more interested in such topics. The lab this was very difficult for me. It took me the whole lab and I still couldn't implement the first function that was required. But then at home I figured it out after rigorous thinking. CSC148 is proving to be something!  

Sunday, March 9, 2014

Week 8 - March 3rd

This week's lectures were smooth enough. I learnt a new form of list called "linked lists". I thought it's a very neat way of organizing a list. Things are beginning to get a lot tougher. I have to think very hard in order to do those lab exercises. This weeks lab exercises took a long time. I didn't get to finish it. Linked lists offer a background when learning about binary tree nodes. Binary trees can be very complicated!

Sunday, March 2, 2014

Week 7 - Feb 24th

Reading week was great! Did lot's of computer science over the break. This blog is going to be on my reaction to "recursion".
 
I believe recursion is an integral part of computer programming because honestly, it makes life a lot easier if you're a computer programmer! During my introduction to recursion, I thought that recursion was just complicating things for me and everybody. Later, I realized the importance of recursion through the assignment and labs. When I tried doing the 'Assignment 1 - Ann Hoy's cheese problem', I tried to do the assignment without recursion because it was very complicated. Hence, I tried using the different approaches but failed miserably. So, I finally used recursion and it worked like a charm! Recursion added more efficiency, neatness, and laziness to my code! I learnt in class that, being lazy in your code is a very important characteristic to becoming a successful computer programmer! 

I think the reason I struggled with recursion is probably a reason every beginner in computer programming struggles with and that is recursion is a very "unimaginative" concept to the human mind. To clarify, the concept of recursion is too broad and super complex according to the standard human brain hence that is why computers can easily deal with recursive structure. I find that pretty cool! I am starting to like recursion now. It makes my code way more efficient.  



Week 6 - Feb 10th

Lately, CSC148 has been a bit of a challenge but it's not that bad. All the midterms and assignments have made me shift my attention from CSC148 to other courses. However I am still attending the labs and they have been fairly straightforward. This week's lab was based on tracing of recursive functions. Tracing by itself (regular code) has been a major weak point for me in computer science (as I mentioned in my previous blogs) and after being introduced to tracing recursion, it bewildered my mind! Consequently, with the help of my TA, by the end of the lab I was able to successfully trace recursive functions! 

Sunday, February 9, 2014

Week 5 - Feb 3rd

This week was a terrible snow week. I was able to attend CSC148 only once this week. That class was very interesting as we covered more recursion and how to trace it. As mentioned in my previous blog post, I struggle with tracing at times, but last class gave me a fair insight on how to trace recursive calls. Subsequently, the lab was also a good experience as I got to apply what I learnt in class. However, the lab coding was challenging because it required thorough understanding of recursion which I did not have as of yet but by the end of the lab, I managed to complete the coding problem. Although I wanted to attend the second lecture this week, I was stopped due to the terrible snow storm (p.s. I am a commuter).