Friday, October 25, 2013

Linked Lists

Linked Lists:

Linked lists are recursive data structures that dynamically store objects as nodes. These nodes are linked to other nodes. In regards to regular lists, linked lists offer more freedom regarding inserting and removing a new node into the list. As a result, a linked list performs better in certain instances than a regular list, as seen with different implementation of queues. Linked lists are not new concepts for me, as I've dealt with various problems dealing with linked lists, so it was much easier to understand than say, for someone who has not dealt with linked lists before.

Sunday, October 20, 2013

CSC148 Midterm

CSC148 Midterm

On October 16th, I wrote my first Computer Science midterm. It included many of the different topics we learned in the course so far, such as object-oriented programming and recursion. Although this was the first midterm I've taken in Computer Science, the style of the test was something I was used to. Analyzing code, figuring out what it does, and implementing/writing down new lines of code were common problems I had to do in high school, thanks to I.B. However, it certainly was a step up from those mere high school questions. I now know the type and difficulty of questions that we are expected to answer, and though I feel I did well on the test, I feel I can be more prepared and ready to take on the exam, which most certainly will be a challenge.

Monday, October 14, 2013

Object-Oriented Programming and Recursion

OBJECT-ORIENTED PROGRAMMING
Object-Oriented Programming, or OOP, is a popular programming technique often utilized. The idea behind object-oriented programming is that an object is created, along with various functions that the object corresponds to. Every object in programming has its attributes and its behaviours. For example, if the object were a car, its attributes would include gasoline and what type of car it is; its behaviour would include driving, reversing and parking. Object-oriented programming also provides a key number of new concepts and functions that make programming much easier. These concepts and functions include inheritance, which allow objects to inherit the properties and behaviours of other objects (e.g. trucks inheriting the properties and behaviours of vehicles) and polymorphism, which allow objects to behave differently under different circumstances. OOP is therefore quite useful in making programming an overall easier and simpler process for the experienced programmer.

RECURSION
Recursion is a programming technique among the likes of for loops and while loops. The basic definition of recursion is that it is the process in which a function repeatedly calls itself by the definition of the function itself. Mathematical concepts, such as factorials, are thought of as recursive processes, and are therefore expressed in programming as recursive functions. Recursion, although useful in this sense, is not exactly useful in terms of efficiency. If, for example, recursion is used to repeatedly call a function multiple times, it would take longer to reach the base case of that recursive function. Therefore, utilizing a loop would be deemed better in terms of efficiency. However, recursion does have its benefits, as it can be used to simply the problem at hand, which is what mathematical concepts such as factorials need: simplification.