Wednesday 26 March 2014

Sorting and Efficiency

    Ever since I took 165 last semester, I had been interested in the concept of efficiency, and to a lesser extent, sorting. The fact that different sorting algorithms have different efficiency levels according to the best case, the average case, or the worst case is intuitive, and a very exciting thing to think about. For example,  an algorithm such as selection sort has N^2 running time, with N being the length of the list. Even in the best case, selection sort needs to check every element of the list, hence the running time is still N. The difference between N running time and N^2 running time seems small at first, but for large numbers of N, the difference is very substantial and noticeable. This difference is easily noticed when comparing the speed of two algorithms. For example, a race was demonstrated in lecture that featured select sort and merge sort. For small lists with less then 100 elements, the time difference was miniscule, and the race was very close. However, for large unsorted lists, merge sort was clearly the better algorithm. Merge sort boasts a worst case running time of NlgN, clearly trumping the N^2 worst case of selection sort. Merge sort has a better running time in most cases because instead of looking through every element of the list, it eliminates redundancy by cleverly manipulating the list into halves, and recursively calling merge on the both the left side of the list, and the right side of the list. Sorting lists has been a fascinating topic to study, and the different methods to sort lists are all quite clever in their implementation, especially the recursive ones.

Monday 3 March 2014

Recursion

Recursion has been a critical topic in 148 for  a while now, and now I get a write about it!

Recursion is a topic heavily discussed, and for good reason since it is difficult to wrap your head around.

Using the function in the body of the code of the same function not only is hard to describe in words, but is a ridiculous concept in itself. Obviously, without some rules, the function would explode and keep going until the end of time (if there was no recursion limit!). To prevent this, and to keep the entire recursive function working, there is always a base case to stop the function from repeating itself. Figuring how to write a base case for a recursive function is the most difficult part of recursion, as it takes an understanding of how the function is being called EACH time and the code has to work EACH time as well. Recursive functions are very useful for things such as nested lists, as it allows python to go over each nested list separately and it doesn't matter how deep the nested list is. Once a recursive call is traced, you know the value of that call so I found it very helpful to use the value that is produced from the call instead of tracing the entire call from the beginning over and over again.

Recursion is a useful tool that I hope to master by the end of this course!

Friday 7 February 2014

Week 5 - Getting sick

and tired of this SLOG thing.

also, its very cold.


Recursion wasn't as fun as I thought, as this week's lab was quite the confusing piece of code. I wish I could describe what I did to work through it, but to be honest I haven't really been thinking about it. I just hope the concept of recursion will be more clear with more examples and more practice.

Eventually, I am going to need to use recursion for assignment number 1, but until then, I can live in ignorance and bliss!

This week in lecture was pretty good times, and learning about scopes and namespaces, as well as learning about using recursion to move cheeses around was pretty cool. I wish I would devote more time to this class, considering that I'm pretty likely to have computer science as my major, but learning stuff is hard and requires effort.

I really, really hope that I can figure the assignment by next week, and if I don't I'm sure to write in this SLOG about it! How exciting!!!

Wednesday 29 January 2014

Week #4 - In Retrospect

I'm so cool for using a different font. I'm a unique snowflake, I swear!

I'm deciding to write in this blog during my psychology lecture, because any class that isn't CSC148 is inferior in every way possible. It has nothing to do with the fact that I'm bored out of my mind. Nope.

So I've been reading other people's SLOG's, and I'm honestly quite surprised that my fellow students put so much work and effort into their posts! I guess the fact that the SLOG is worth a hefty portion of the grade doesn't hurt, but still. I realize In Retrospect ( see what I did there?) that I definitely slacked on my entry, and that I should have wrote a lot more.

Oh well. We all make mistakes, I guess.

So this week was about recursion, and its very intriguing. The concept of recursion was completely new to me, and learning it was a fresh perspective on python. I am kind of scared and excited for the many doors that recursion opens in terms of programming, and am waiting anxiously for the next lab.

Speaking of which, this weeks lab was very hard.

University is very hard.

The exercises are very enjoyable (read: easy), though. They make me feel all good about myself and I can pretend that I'm a great student with no p

Tuesday 21 January 2014

Object Oriented Programming

I'm becoming more and more fond of object oriented programming every day. At first, it was kind of an annoyance, another skill that I was forced to learn, but these past couple of weeks have opened my eyes on how exciting and intuitive object-oriented programming can be.

Specifically, I really enjoyed the lab this week because I was able to complete it, and there are few things comparable to the joy you get when a piece of code works. I feel like i have a better understanding of how classes work thanks to this weeks lab, and overall feel pretty savy and confident in my ability to deal with python in general.

I'm hoping that this feeling will continue, and I'm also hoping that this is enough writing to satisfy the vague requirement of "a few paragraphs".

Blogs are fun.

Saturday 18 January 2014

First

I'd have never imagined that for all the courses I was taking, computer science would be the one  class where I flex my writing muscles that i haven't used highschool.

I can't decide how much I like having to be forced to write, just like I can't decide if I'm really enjoying 148 so far.

I think this is a good enough entry for a first- timer.

We can all pretend.