The importance of recursion was not quite clear to me when I was first introduced to this subject halfway into the semester. I viewed recursion as a quicker tool to solve problems that required similar functions occurring repeatedly, but I only considered it as a quicker alternative to methods that already existed to solve similar problems. But once I was introduced to Trees and Binary Trees later on into the semester, the necessity of recursion became quite apparent to me. Trees can be branched into multiple levels, and the only way to cover each level and make sure any calculation or function we are trying to accomplish with these components of a tree runs through every level is recursion. Thus, the importance of recursive functions becomes clearer after understanding the functionalities of a tree.
My Week 7 post about recursion tries to explain the general structure of a recursive function and how it reduces the code necessary to perform a repeating task without a recursive method. But now that I have gained much more insight into the depths of recursion and its uses, its structure and complexity can vary greatly, completely depending on the problem that is supposed to be solved. I have come across some very complicated problems that requires extremely sophisticated recursive thought process and coding to solve, and that just proves that nothing is ever too easy in computer science. But I am proud that I am understanding such in-depth concepts of computer science and I cannot wait to learn more about concepts like recursion and trees, and whatever new challenge comes my way. It has been quite a pleasure attending Professor Heap's lectures, and I really hope I can put all this information to good use during my finals. This is Jarraf, and I am signing off for now. Those finals won't study for themselves. Until next time friends, Adios!
Adventures in Computer Science: A SLOGtastic overview
Delve into the vast world of computer science, as I share with you guys the unique experiences I encountered in my cs148 class, as well as the lessons that I learnt and achievements that I have accomplished throughout this entire semester.
Saturday, 9 April 2016
Friday, 4 March 2016
Week 7: Recursion..Is it really hard?
Recursion was the nightmare that many csc148 students dreaded since the beginning of the year. The amount of fear the word "Recursion" generated was actually quite hilarious. The negativity and the rumours about its difficulty can be justified in certain terms, but overall, the concept of recursion is actually quite straightforward when analysed under scrutiny. The key to understanding recursion is to approach the idea not as you would approach other ideas in programming, but thinking logically. Instead of trying to fit the notion into a familiar depiction of coding, we have to understand recursion by looking at a completely new slate.| You get the idea |
![]() |
| A helpful visualization of a recursive function finding the factorial of 5 |
I will be back with another log for next week, but until then, Adios friends!
Thursday, 3 March 2016
Week 6: Assignment 1 Final Lap
This week was the week when the first Assignment was due. My group has been consistently working on the assignment since the beginning of the term test, and we have made huge progress, but small errors always keep popping up, making the coding process much more frustrating than usual. The presence of so many different files, and the necessity to check the unittests for each file to make sure there are no failures is a great ordeal every time we are trying to make some changes to the backbone of any class. The connectivity between every class also makes it quite a hassle to find errors sometimes, as it can be interconnected deeply throughout multiple classes. But overall, we worked as a team, and finished up the assignment before the due date. Two days before the due date, me and my group actually stayed up till 3 am at our residence common room, just grinding away at all the bugs and errors, as well as finishing up docstrings here and there throughout the assignment. The final product worked as it should, and we happily submitted it the day before the due date with a satisfactory confidence.
As for the lab for this week, I learned some very useful codes that I never used before, namely, the zip tool for tuples or lists, the multiplication of vectors with vectors, and vectors and matrix were the highlight of our lab and the week's quiz. I found these tools extremely helpful, and paired with the list comprehension strategies we learned in the past weeks, it makes a serious change in the efficiency of coding. Overall, it was quite an interesting week, with some hectic last-minute fixes on our assignment and introduction to quite a few new techniques for coding.
As for the lab for this week, I learned some very useful codes that I never used before, namely, the zip tool for tuples or lists, the multiplication of vectors with vectors, and vectors and matrix were the highlight of our lab and the week's quiz. I found these tools extremely helpful, and paired with the list comprehension strategies we learned in the past weeks, it makes a serious change in the efficiency of coding. Overall, it was quite an interesting week, with some hectic last-minute fixes on our assignment and introduction to quite a few new techniques for coding.
Week 5: Term Test 1 and a final look at Linked Lists
This week was not as eventful as others in terms of learning new materials, as the first term test was scheduled for February 10th. Thus, the Monday lecture was a brief review of everything we needed to know for the test, as well as occasional references to our first assignment. Speaking of the assignment, I finally put together a group for this assignment, consisting of 2 of my friends living on the same floor of my residence, and we had been brainstorming different methods to solve this assignment quickly and efficiently. The night before the test, we actually worked on our assignment, because everything on the assignment is pretty much a review for the test, so if we were able to do the assignment, we would be quite prepared for the test. After a lot of trial and error runs, we finished up almost 50% of our assignment that night, and checked each function and classes for syntax or logic errors. We even completed the docstrings for all the functions that were done, for practice before the test. On the day of the test, I did not have the lecture, as mine usually goes from 10-11, and that's when my test was. I woke up around 7:30 and got ready for the test. During the test, I actually started panicking because of the incredible amount of coding we had to get done within that 50 minute time frame. Luckily, I made a really crucial decision to skip the 2nd question with the multiple sub-classes and finish the last stack function first, before going back and finishing up question 2. This last-minute resolution helped me complete the test and I was very satisfied with my answers.
During Friday's lecture, we learned a bit more about linked lists, and as I mentioned in the last post, the professor explained to us why it is sometimes more efficient to use a linked list, and sometimes why it is not the most effective tool to be used. Of course, it was related to the index positioning of the list tool, and the nodal connection of the linked list, and how each has its pros and cons. The lecture was very useful for anyone who was having a hard time understanding the reasoning behind using such a complicated tool as linked list. And that officially ended my learning and experiences from CSC148 for Week 5. I'll be back next week with more updates and new material. Until then, Adios friends!
During Friday's lecture, we learned a bit more about linked lists, and as I mentioned in the last post, the professor explained to us why it is sometimes more efficient to use a linked list, and sometimes why it is not the most effective tool to be used. Of course, it was related to the index positioning of the list tool, and the nodal connection of the linked list, and how each has its pros and cons. The lecture was very useful for anyone who was having a hard time understanding the reasoning behind using such a complicated tool as linked list. And that officially ended my learning and experiences from CSC148 for Week 5. I'll be back next week with more updates and new material. Until then, Adios friends!
Sunday, 7 February 2016
Week 4: Linked Lists, Queues and Stacks
This week, the CSC148 lectures were a bit more oriented towards learning specific materials that are unique to programming in general. The introduction and usage of linked lists, queues and stacks were the primary lessons learned during this week, but many other sub-topics also appeared during these sessions, that were covered in class and during the labs.
Linked Lists
The idea of a linked list is very different when compared to objects like vectors or lists. The presence of a "node" to keep track of objects or information in linked lists is definitely a very interesting concept, even though a bit complicated to absorb at first glance. I was having trouble understanding why it was necessary for us to use linked lists, when simpler tools like lists or dictionaries exist to perform similar activities. But after researching linked lists, trying out some codes as a trial and error process of learning, and absorbing information from the lectures and course notes, I realized that linked lists have its own unique advantages that make it a very useful tool in programming when it comes to insertion or deletion of objects. In a list, the insertion or deletion of a specific object, like a number, at a specific place, would require the entire list after the number to be shifted left or right, depending on the type of modification. When there are hundreds or thousands of numbers on a list, and an insertion into a specific index is necessary for a particular number, this process can be very inefficient when using lists, due to the necessity of shifting each value after that required index. But when using linked lists, the presence of the nodes connecting each element makes this process much faster, just changing the node's focus from the number in front of it, to the new number, and have the node of the new number connect to the next occurring number. Obviously, lists have its own advantages as well, like being able to call upon specific objects very efficiently due to the presence of index values, and the disconnected presence of each element on the list. Thus, linked lists is a more efficient way of adding or removing elements onto the list without having the computer perform extra work.
Stacks and Queues
Stacks and queues are simpler concepts to understand compared to linked lists, and my previous experience with coding in Java and C++ made these lessons easier to contemplate and utilize. The lab was also a very useful material in order to bring together these tools into a programming assignment and realize why it is important to have such tools present for use in a coding environment.
Overall, I believe my greatest achievement this week was just being able to understand the necessity of all these new tools, and how they can be implemented into the Python language for more efficient, seamless coding. Introduction of these new concepts are helping me reach greater depths in terms of what we can accomplish with our knowledge of coding, And it means we can now delve into much more complicated assignments and labs, that can be connected to real-life situations, like developing a super-class of Vehicles, and having sub-classes for various types of vehicles, like cars, trucks or bicycles, while each class will have its own properties and characteristics. We can even use linked lists to join multiple vehicle objects in order to keep track of them, and easily insert or delete specific vehicles from the list when necessary. Many such problems can now be solved due to our familiarity with these new tools, and I cannot wait to learn more about the awesome Python language.
Linked Lists
The idea of a linked list is very different when compared to objects like vectors or lists. The presence of a "node" to keep track of objects or information in linked lists is definitely a very interesting concept, even though a bit complicated to absorb at first glance. I was having trouble understanding why it was necessary for us to use linked lists, when simpler tools like lists or dictionaries exist to perform similar activities. But after researching linked lists, trying out some codes as a trial and error process of learning, and absorbing information from the lectures and course notes, I realized that linked lists have its own unique advantages that make it a very useful tool in programming when it comes to insertion or deletion of objects. In a list, the insertion or deletion of a specific object, like a number, at a specific place, would require the entire list after the number to be shifted left or right, depending on the type of modification. When there are hundreds or thousands of numbers on a list, and an insertion into a specific index is necessary for a particular number, this process can be very inefficient when using lists, due to the necessity of shifting each value after that required index. But when using linked lists, the presence of the nodes connecting each element makes this process much faster, just changing the node's focus from the number in front of it, to the new number, and have the node of the new number connect to the next occurring number. Obviously, lists have its own advantages as well, like being able to call upon specific objects very efficiently due to the presence of index values, and the disconnected presence of each element on the list. Thus, linked lists is a more efficient way of adding or removing elements onto the list without having the computer perform extra work. Stacks and Queues
Stacks and queues are simpler concepts to understand compared to linked lists, and my previous experience with coding in Java and C++ made these lessons easier to contemplate and utilize. The lab was also a very useful material in order to bring together these tools into a programming assignment and realize why it is important to have such tools present for use in a coding environment.
Overall, I believe my greatest achievement this week was just being able to understand the necessity of all these new tools, and how they can be implemented into the Python language for more efficient, seamless coding. Introduction of these new concepts are helping me reach greater depths in terms of what we can accomplish with our knowledge of coding, And it means we can now delve into much more complicated assignments and labs, that can be connected to real-life situations, like developing a super-class of Vehicles, and having sub-classes for various types of vehicles, like cars, trucks or bicycles, while each class will have its own properties and characteristics. We can even use linked lists to join multiple vehicle objects in order to keep track of them, and easily insert or delete specific vehicles from the list when necessary. Many such problems can now be solved due to our familiarity with these new tools, and I cannot wait to learn more about the awesome Python language.
Wednesday, 27 January 2016
Week 3: An Introduction and Future Goals
CSC148 is one of the required courses for anyone looking to major or specialize in Computer Science. I have always been interested in programming languages, and coding different applications that can be utilized in real life situations. After learning the basic background information necessary to delve deeper into the Python language from CSC108, this course is finally focusing on the real-world applications of programming and problem solving by introducing us to the Class structures, and efficient programming methods in order to cut down on unnecessary codes. Even though we are still in the preliminary stages of this course, the usefulness of efficient coding and relating problems to real-world situations can already be seen in our class exercises and even in the first lab. CSC148 does start off at a much quicker pace than CSC108, and it is essential to keep track of the speed at which the professor is covering all the materials. I am quite thankful to have such a knowledgeable and entertaining instructor as Professor Heap, and I always look forward to attending his classes, in hopes of learning more about this intriguing topic, as well as be entertained. The topics that have been covered in class are listed below along with some personal comments:1. Turtle: The turtle class was actually a completely new concept for me, but it was rather straightforward and easy to understand and utilize
2. Classes: Definition of classes, as well as structure and sub-classes were introduced soon after the association with the turtle class
3. New Docstring Format: Quite an important change of events from CSC108, as docstrings (a set of information about a particular function) are written in a completely new format now
4. Generator Expressions/ List Comprehensions/ Sorting: Part of the week 2 reading, provided very useful information about code efficiency when creating lists or dictionaries and much more. Different ways of sorting was also introduced, including "Sorting with Keys", and "Sorting with DSU"
5. Lab on Class structures: The first lab was extremely helpful in order to start getting used to the formatting of classes and function docstrings, and the quiz really helped apply all the lessons learned from it
![]() |
| The perfect Log :) |
Subscribe to:
Posts (Atom)

