CS50x Week 4: Breakout (Problem set)

GUI (Graphical User interface) is interface that interacts with user through graphics as opposed to text user interface that interacts through text. For example, a game of tetris uses the GUI, while old game such as Discworld MUD uses text user interface. This week, we used an API (Application programming interface) provided by SPL (Stanford … Continue reading CS50x Week 4: Breakout (Problem set)

CS50x Week 4

Topics in this week’s lectures and shorts: Merge sort. Pointers. When is pointer used? Array are pointers. String is an array of characters. Merge sort Merge sort is a sorting algorithm that uses recursion. Recursion function as explained in 6.00.1x Week 3, is a function that calls a smaller version of itself. The pseudocode and … Continue reading CS50x Week 4

6.00.1x Week 3 (Problem Set)

There are two problems in this week’s problem set, one requires us to calculate the radiation exposure, another one requires us to program a hangman game. Radiation exposure Radioactive substance will undergo radioactive decay and emit radiation, over time, the amount of radioactive substance will reduce. The time required for a radioactive substance to reduce … Continue reading 6.00.1x Week 3 (Problem Set)

6.00.1x Week 3

This week, we learnt about recursion and different compound data types. Recursion Recursion means repeating similar version of something. In programming, a recursion function is a function that calls a smaller version of itself. It is useful for problems that can be represented as smaller version of themselves. The concept of recursion can be condensed … Continue reading 6.00.1x Week 3

CS50x Week 3: Game of Fifteen

This week I learned different sorting and searching algorithms. Sorting means arranging the elements in an array in ascending or descending order. Searching means finding an element in an array. Sorting algorithms Bubble sort Selection sort Insertion sort Quick sort Searching algorithms Binary search Bubble sort Imagine you have a list of numbers, from left … Continue reading CS50x Week 3: Game of Fifteen

6.00.1x Week 2 (Problem Set)

This week’s problem set deals with programming scripts that show what is the minimum amount of money a student has to pay in order to pay off his credit card balance in one year. There are 12 months in a year, and each month, interest will be incurred on the balance, the updated balance after … Continue reading 6.00.1x Week 2 (Problem Set)

6.00.1x Week 2

In week 2, I learnt to write functions in Python. The format of function in Python is as follows:

whereas in C, it is written as:

To program a basic function such as function to find the square root of a number, there are many approaches. We can use: 1. Linear search (exhaustive … Continue reading 6.00.1x Week 2

Starting MITx 6.00.1x Introduction to Computer Science and Programming Using Python 2014

I started another OpenCourseWare (free online course), MITx: 6.00.1x Introduction to Computer Science and Programming Using Python, provided by MIT and hosted on edX. I am currently also learning C with CS50x. When I was trying out the Project Euler questions, I realised that C cannot compute very large numbers, while Python can do it … Continue reading Starting MITx 6.00.1x Introduction to Computer Science and Programming Using Python 2014

CS50x Week 2: Crypto

There is a lot of reading this week. Among the books in the reading list, I would recommend Absolute Beginner’s Guide to C by Greg Perry for beginners, the book is easy to follow and not boring. Programming in C by Stephen G. Kochan is a bit lengthy and harder to follow for beginners, but … Continue reading CS50x Week 2: Crypto

CS50x Week 1: C

I have learnt about libraries, compilers, switch statements, and typecasting. When we are programming, we are giving instructions to the computer to carry out tasks. However, the programming language like C is considered a high level language. High level language is easy to read (resembles english), while low level language is cryptic. Computers only read … Continue reading CS50x Week 1: C