Monday, October 28, 2013

Binary Search Tree

As introduced recently in class a BST (Binary Search Tree) is a special type of a binary tree that has a new property. The special thing about a BST is that every element in a tree is larger than its left child and smaller than its right child (if they exist). The element of the tree (nodes) don't have to be numbers, they should simply by comparable objects. Arranging elements into a BST can be viewed as sorting the elements, since such arrangement makes it easier to search through all the elements. In particular, this turns the linear search with the order of n into a binary search which has a complexity of log2(n).

Monday, October 21, 2013

Midterm 1 Thoughts

It's now 5 days since I had my first CSC148 midterm and my first midterm at UofT. To be honest I was really nervous and couldn't calm down. From my own experience I know that I perform much worse when I get nervous on an exam. And this is exactly what happened. I started jumping from question to question without completely finishing any of them. I just don't know why this happens to me. At the end when question 1 was half way solved correctly, I came back to it and decided it was wrong, so I erased it and wrote some senseless stuff. I'm gonna try and improve next time by keeping calm and relaxed.

I would be very glad to hear how other people deal with such a problem if they also experience such a thing.

Sunday, October 13, 2013

Hello Everybody!

As assigned, today I'm gonna talk about my own perspective/understanding of on Object Oriented Programming and Recursion.

Object Oriented Programming is a specific approach/style in programming. This particular approach represents pieces or parts of an application in form of objects. These objects usually have their unique set of attributes/characteristics that describe them and a set of methods/functions that enable objects to perform some sort of operations. This existence of separate objects that make up a program allows the developer to break down a large scale problem to smaller pieces. It's important to mention that a program is operating based on the fact that the objects that are specifically designed for a particular program interact with each other (do things to each other) and not because such objects just exist. Once all the separate pieces (objects) are ready and put up together, the whole program is ready. It's like producing a car where all the parts (objects) are put up together and a result is a ready vehicle.

In general, recursion is a process of repeating things (actions) in a self-similar way. In computer science recursion is used as a way of solving problems by providing instructions in a repetitive manner. In particular this refers to the process of implementing methods/functions. To give the class a description of what its objects should be able to do, we have to provide the class with a very accurate and detailed instructions. In some cases we want a particular method to do repetitive actions over and over for an unknown number of times. In this case it becomes impossible to provide a perfect description of each case. So instead we describe in the method the way and the cases in which a method should repeat itself until the problem is solved. Even though in general recursion provides a shorter and a more elegant solution to a problem, it's sometimes not the most efficient way to approach a problem.

Good luck everyone...