Friday, April 3, 2015

End is near, Good-Bye 148!


Finally, a final class as we approach closer than ever to the final exam. (Too much of final, yeah?)

What-a-semester! Without any doubt, 'Recursion' is the word-of-year for me. I don't know whether I'm afraid of it, or feel excited about it, I just know that this word brings on a challenge every time I hear it.  Assignment 3 is due tomorrow, but for-a-change, my group has already finished it a day before (That's amazing. Truly astonishing seeing our past record.)

The course has been a great encouragement for me personally. It gave me a chance to think beyond what I would have done. It ensured I logically understood the problem and enhanced the critical thinking. Everyone who's looking toil hard and is interested in a brain-applied fun course, this it it:  CSC148! Working through the assignments with peers or going through the labs with the help of TAs, the course was filled with information popping from everywhere. Moreover, both the midterms were a good review of what had been taught in class, which helped students gained some confidence over the little rough-patch of demanding coding topics.

Danny, the leader of the pack! Danny has been a great instructor. I feel in subjects like CS, you need someone who can hold up the class to interest, and Danny perfectly did that. He brought up illustration on triangles, bringing a cushioned animal to show arrows in class and coming up with light jokes in class. He explained the assignments in class well before hand so that everybody could get a good idea how to work over them before hand.

It's been a great journey with everyone associated with the course.
Thanks everyone and goodluck for the finals to my fellow peers.

Signing off,
Abhinav Chawla 

Friday, March 27, 2015

(Renamed: Revisit, Week 11) And here we are.....


What started as an exciting lecture in WB116 turned out to be one of the most intriguing course of my first year. It was tough and rough, yet the only course which gave me a feeling of 'Like-a-Boss!' after solving the basics of the problems. This class has definitely opened my views about the Computer Science and given me a wider perspective to look at the core logic of a certain problem. No one can deny the fact, that this course gave me something new to work over week-by-week (For me atleast).

The one thing that made the course easier was 'The Friend Community'. We all sat, ate, cried and coded. I would like to mention few of their viewpoints I really liked below:

Nagee Elhgassein: It's starting to link:
I love the way Nagee brought a nice taste of humor to the otherwise monotonous SLOG writing. Moreover, the reason I particularly liked this post was that he mentioned the amount of work he was going through that week. It has happened to me as well, few weeks are as easy as you're having vacations in Bahamas, and then a couple of weeks come with work piled to the top roof.
Nagee and I have been constantly discussing our ideas over the CS, and I feel really happy to go upon discussing some good ideas with him. Way to go, Nagee!

Anam Alvi: My Problem Solving Biceps Are Growing:
Now that's some engaging title, 'My Problem Solving Biceps Are Growing'. This post of her perfectly reflects what we, as a group of three, faced during the assignment 2. It was tough as I mentioned in my post 'Mission Minimax'. Yet, we all worked over it and enjoyed implementing it. The number of (wrong) ideas that followed were pretty high, still we felt happy to atleast come with something rather than nothing. I shouldn't feel ashamed to say this, but yes Anam, even I feel 'My problem solving biceps are growing' ;)

Jahid Ahmed: Debugging Logs
You write a code. Run it. 2 Errors. You fix the errors. Re-run it. 13 Errors!
This has been my Wing IDE usage for the last 2 months. Debugging has been a very important part, though it wasn't very easy as it may sound. Finding a mistake is way more difficult than correcting it for most of the times. I liked the way Jahid mentioned to set breakpoints and maintain a journal over the time. We had spent a lot of time working over the problems in the labs, and we know the time we had to spent on few of the errors especially in the last couple of labs. It was fun whatsoever.

There have been really interesting slogs on the board, and really appreciate the time people have devoted on writing some fabulous mini-articles.
Goodluck everyone!

Sunday, March 22, 2015

Complexity. Big O(h)!



Complexity. The week took to topic that has a vital role in a computer programmer's life. How different algorithms can do the same thing. Exactly same. But, still a lot different. It's not just about the expected outcome, but also the quickest and the least expensive method.

Without digging deep into the Big O problems tackled in the class, I would like to about something that I find very interesting which suits the present topic perfectly.

I had watched a lecture of Harvard's CS50x course by David Malan which had something very intriguing to the same topic. I'll like to brief it out here, as it left a great impression on me about run-times.

He did a practical experiment in a class of 700-odd students. The aim was to calculate the number of students present in the class as quickly and efficiently as possible. So, one way was to go to each student one by one and count. Or, count taking two students at a time (2 + 2 + 2 + ...........).

Then, he proposed an algorithm. It showed up on the big screen and was the following:
1) Stand Up.
2) Think to yourself, 'I am #1'.
3) Pair up with someone; add your numbers together; take the sum as your new numbers.
4) One of you should sit down.
5) GOTO step 3 if still standing.

The video:  https://www.youtube.com/watch?v=79gAss0K1TI&list=PLhQjrBD2T382Lqs7bsMl6WRDA9anaEzBe#t=1226

So, all the 700-odd students stood up. In first round, half of them sat down, with everybody standing with number 2 with them. This continued, and next half of remaining sat down. And it continued. Till only one student was left, with the number of students with him. The amazing thing was, it took less than 10 steps as from ~700 we had ~350, followed ~175 and so on. Rather than going through all the 700 students, it was done in just 10 steps. Isn't it awesome? It was to me when I first saw it for sure. From a linear counting, it showed an easy way to calculate it exponentially.

This is a great example that presents that there are various methods in which you can solve a problem, but it comes down to the fact that your solution must not only be efficient enough to give the desired results, but also fast enough to solve it. As I mentioned, the most simplistic idea that comes to the mind is to count the number of students one-by-one, but sadly it is one the most inefficient way to solve our problem. Dealing more into it, the method proposed by Prof. Malan opened a new thinking approach that the simplistic answer may not be the one you're looking for. Moreover, the perfect (or nearly perfect) answer must not be a very complicated or hard-to-grasp, as we see in this problem, the algorithm was fairly intuitive.

                             

(A linear approach. Counting one by one)


(Using the approach explained above)

I hope this illustration makes easier to understand what's actually happening in these two different approaches. 

Tuesday, March 17, 2015

Midterm 2 arrives


We had our second midterm of the course this week. It focused on recursion, and I wasn't very comfortable after learning from that most of the students came almost crying after the recursion midterm previous term. Yet, I feel Danny showed some mercy and gave us a doable test. I put good use my aid-sheet in second question after quickly working out the first one on my own. Third question was the trickiest one, but I spent some time before I figured it out as well. I used the approach of drawing the illustration of a linked list, and analyzing the problem. It worked pretty well and overall, I was happy with the exam.

The Monday before the exam, we went through Binary Search trees in class. I liked the way of gathering data such that we can have certain comparable conditions applied on the child nodes which makes it easier to traverse to the required point. In our work, we ensured the left child has a value less than the parent node, and the right child has a value greater than the parent node itself.

A Binary Search Tree

So now if we consider the example above, and we need to find the number 13, starting from 15, we know that 13 is less than 15, so it will lie somewhere in the left sub-tree, and further 13 being greater than 11, would lie to the right sub-tree of 11, which specifically is the leaf. This way, we reduce the steps the program would have otherwise taken to reach the required 13.  

This week, 4 Midterms in 3 Days, wish for me. Please do!

Wednesday, March 11, 2015

Mission Minimax


I ended my previous Slog with a hope to 'conquer Minimax'. I feel elated to say, that finally after sweating for days, my team was able to complete it. I felt that this was the start of Computer Science. This was the first 'hard' assignment I'll never forget. It made me think. I made me sweat. It made me work. Yet, I was finally able to code it down in the end. We had already completed other parts of the assignment before touching down Minimax, and hence were able to submit the assignment on time.
(I hope the TA Strike get's over soon, because I'm eager to know how well I did on this assignment, for once!)

In class, we discussed over Linked Lists. The diagrammatic representation made it fairly easy to grasp the idea behind it. With playing over few methods this week, and solving out the lab problems at home, I seemed to be confident about it. The other good think I liked about it was that I was able to find different logics to solve one single problem as compared to few previous weeks, where finding even one recursive call sometimes was a big deal.

Monday, March 2, 2015

Binary Tree: One Parent, Two Childs!


This week of class focused on the binary trees to start with. (Actually, it wouldn't be fair not to tell that we did spent starting halves of the both the lectures discussing A2.) The idea behind binary trees was pretty easy to grasp, and so that wasn't much of a problem.


Jokes aside, Danny showed us few methods working over the trees. Still, recursion was needed to be swept in by the brain. This weeks lab was one of the harder ones for me, as few of the recursive calls took some heavy amount of time. None-the-less, it was a good practice and learning experience. Also, we did the three traversal ways: Pre-Order, In-Order and Post-Order in the class. These weren't tough, just had a slight variation.

Everything seemed going well, until I started working on Minimax. I have spent a lot of hours figuring out the problem, as I feel I have got it, some sort of an error pops up. I hope I can get over this challenge soon. Catch you next week after 'conquering' Minimax!

Saturday, February 28, 2015

Object Orientated Programming


Digging a bit down to the history of Object Oriented languages, I found a phrase that summed it up: 'It's all about the network!'. As Internet grew, OOP grew alongside. While going through the history of rise of OOP, I came across something that I think is useful to share it here. Java was the earliest of the languages based on Object Orientation, and the fact that it led to be so successful was that it could change how a HTML webpage worked drastically. With the oncoming of Java applets, we could now move from a static (and a boring) webpage to a dynamic webpage with tons of added functionality.

Now, the big question still remains open, 'What is Object Oriented Programming?'. Before OOP, the codes were basically a long chunk of a single-piece code. You could add functions but the whole logic and data was bundled as one which was less modular and flexible to work with. In an object oriented program, you can have multiple self-contained objects which could each work as mini-programs coupled with each other to serve at the bigger picture. Each object can have its own data and logic, which may sound confusing at first. But, actually this let's you to simply work over objects as you do in the real life. (It's a Lamborghini, and it's a BMW. Both are cars, yet different objects)

OO is an idea that used the concept of Classes and Objects, just as we use them in day-to-day lives. Classes give you the blueprint or description of anything that actually does not exist. They define attributes and behavior. For a class mobile, its attributes maybe its size, OS, brand and many more whereas its behaviors could be it's functioning to provide a call, capturing images via a camera etc. Commonly, attributes are referred as properties and behavior as methods. Objects bring out the abstract idea into existence. You can create multiple objects from one blueprint (class), and map or connect different objects to fulfill your needs.

OOP lays a better architectural platform to work over which reduces our chances to mess up where to put the required data and logic associated with it. Moreover, it gives you chance to bypass many things not being used, and makes it easier for the developer to go through correcting his more so-called 'disciplined' code.