Sunday, 28 February 2016

Recursion - Week 6






This week was all about recursion and its usage. Though, the time taken by recursion might be more than the usual loops, it is easier to apply for complex problems.

The function factorial above is made through recursion. Recursion and loops both can be controlled by the programmer(interface).

Here are some rules about factorials, If n = 0 then n! = 1 If n > 0 then n! = 1 x 2 x 3 x ... x n
For example, let's look at the factorial of the number 7:
7! = 7*6*5*4*3*2*1


Let's look at a program which calculates the factorial of any number entered by the user, by method of recursion.

Thursday, 11 February 2016

Midterm Week 5

The first midterm of the course CSC148 was this week. Though midterm keeping the mind in time was really lengthy.

The test was of medium difficulty umm, was not exactly difficult but the build-up of multiple classes took a lot of thinking time.

I couldn't complete the exam in 50 minute and I don't know if I will be able to get 80+ in this exam.

Friday, 5 February 2016

Stacks and Queues - Week 4

This week was about Stacks, Queues and linked lists.
The lab was comparatively easier as I have practised the implementation of Stacks, queues and linked lists in high school in C++.

The implementation was easier than that in C++. The quiz of the lab was about the stack status and how things go inside and out of the queue.

Things go inside and out of the stacks by LIFO(Last in First out) method and in queues by FIFO(First in first out). There are four methods which have been assigned with both of these: Insertion, Deletion, __eq__, __str__.

The system by which one node is connected to another in a linked list really makes it the most interesting part.