List of courses sypnosis and requirements here: FC-COURSES-SYNOPSIS.

## 11th National Mathematics Competition at UTAR

On 18 June 2016, I participated in the 11th National Mathematics Competition at UTAR Sungai Long Campus organized by Universiti Tunku Abdul Rahman (UTAR).

There were many students from different universities joining the competition, totalling 300 students. There were students from National University of Singapore, UTAR, USM, MRSM, Sunway, etc.

## Competition categories

There were 3 categories, A, B, and C. I joined category A and B (individual categories), so I had no idea what category C is about, I only know it is a team based category.

For category A and B, participants are separated and guided to their own computer labs.

Category A consists of 20 questions from topics such as discrete mathematics, probability and statistics, linear algebra, algebra and number theory, and calculus. The participants are given 30 minutes to answer them, 1 mark for one correct answer, and -1 mark for one wrong answer.

Category B consists of 100 questions. The participants are given 30 minutes to answer them, 1 mark for one correct answer, and -1 mark for one wrong answer. The questions are simple arithmetic question requiring only +, -, *, and /. Example: 6783 – 8939 * 9102. You can win the Superman Trophy if you answered all 100 questions correctly.

Category C, I had no idea. But, I know from talking to one guy from Sunway that the organizer can choose team mates for you if you cannot find 2 people to join you during registration. I could have opted for that! Argh.

## Category A – analysis of some questions (the ones I remember)

- Find all non isomorphic 5 vertex tree (connected with no cycle)

Answer: http://math.stackexchange.com/questions/537295/how-to-find-non-isomorphic-trees

Comment: I learnt this in discrete structure subject. Learn what is graph, isomorphism, isomorphism. - You are to catch some flies, there are a delay before catching each fly, catching a fly happens at an instant. The delay to catch the first fly is 1 second. The delay to catch the 2m-th fly is the same as that of m-th fly. The delay to catch the 2m-th fly is less than 1 compared to that of 2m + 1-th fly. How long does it take to catch the 98th fly?
- Sum to infinity k^2/k!
- Two circles r inner radius, 1 outer radius, another circle o tangent to this circle, find ratio of both area as r approaching 1-

## Resources for UTM SPACE SCSR1213: Network Communications

The book is Kurose’s Computer Networking: A Top-Down Approach. This book introduces the internet based on the layers of internet, namely application layer, transport layer, network layer, link layer, physical layer, one chapter for each layer, and also a wireless and mobility chapter because the world is going wireless and mobile.

There are PowerPoint notes prepared by Kurose based on the book available online.

If you are preparing for quiz or exams, it is good to google quiz and exam questions online. This will help you tackle questions more practically.

Quiz/ Exam questions:

- Google “Network communications resources” or copy and paste one question into Google and the rest will be found.
- UCI – http://www.ics.uci.edu/~keldefra/teaching/spring2013/uci_cs132/problemsets/
- UMass – http://server.casa.umass.edu/~zink/ECE374/assignments/
- Unit Engineering – https://uniteng.com/wiki/lib/exe/fetch.php?media=classlog:computernetwork:hw5_report.pdf
- UNSW – http://www.cse.unsw.edu.au/~cs3331/SampleQuestions/
- Utah – http://www.eng.utah.edu/~cs5480/homeworks/
- SCU – http://ccftp.scu.edu.cn:8090/Download/20151226145532505.pdf

## Dijkstra’s algorithm

Before we understand Dijkstra algorithm, let’s introduce the concept of graph. A graph consists of vertices and edges connecting them. A graph has many applications because it mimics the connection between nodes/ vertices in network, social media, map with buildings as nodes and roads as edges connecting them, etc.

Dijkstra algorithm is an algorithm to find the shortest path from a source vertex to a destination vertex in a graph. For example, the graph may be a map. This is useful because a person may want to drive from home to school using the shortest path possible.

Each edge/ “road” is given a value, this is the path cost or the cost to travel this particular road. The shortest path will have the lowest sum of path costs of the edges it travelled.

There may be variations for the implementation of Dijkstra algorithm. For any implementations, each vertex will have a current cost which is continually updated until it reaches the minimum.

# Implementation

To start, we have two sets, S, and N. S contains the vertices that have been processed and N contains the vertices that have not. Initially, S is {} and N is {a, v1, v2, v3, v4, v5, v6, z}.

In Iteration 0, set the current cost of the source vertex as 0 and the current cost of the rest of vertices to a very big value, that is, infinity.

**Note**: Keep track of current cost of all vertices as we will update the current cost of certain vertices of all vertices during each iteration. For now, after iteration 0, one vertex has 0 as current cost and the rest has infinity as current cost.

In Iteration 1, select the vertex from N that has the lowest current cost and move to S. Then, we will update the current cost of neighbours of the vertex we chose. The new currenct cost of the neighbours will be updated by adding the currenct cost of the vertex we chose, and the path cost from the vertex chosen and the neighbour itself.

**Note**: We only update the current cost of neighbour to new currenct cost if it is lower than its current cost. Example, we chose v4, v5 is one of the neighbours of v4, the current cost of v5 is 15, the updated current cost of v5 is the current cost of v4 plus the path cost from v4 to v5, 12 + 6 = 18. Since 18 is more than 15, we don’t update the current cost of v5 to 18.

**Note**: When choosing a vertex from N that has the lowest current cost, sometimes there are two or more vertices with the same currenct cost in N, choose whichever one will do.

Subsequent iterations are the same as Iteration 1.

We continue the iterations until the destination vertex is moved to set S. The current cost of the destination vertex is the shortest distance from source vertex to destination vertex.

Example implementation: https://gist.github.com/shaunlgs/861276b2ff0ba49dc0eb1f3cf10accd0

**Note**: The graph information is stored in a matrix where the row and column are the vertex and the value is the path cost. Example, row 1 (The row are indexed from 0, so row 1 is actually the second row) and column 3, this means from v1 to v3, the path cost is 8.

## Find out if triangle exists based on its length and bubble sort

Today I learnt 1 new idea and refreshed my mind about 1 idea that I knew . I got this knowledge from Wikipedia.

# Triangle

If you want to know if a triangle is possible based on its three lengths, you can do this. Take any two sides, add it up, it must be more than or equals to the third side. The case where it is equal to the third side is called a degenerate triangle, it has zero area, but its still a triangle nonetheless.

# Bubble sort

Bubble sort, go through an array, if the value of the element is greater than the value of the next element, swap them. Keep going through the array multiple times, until you can go through the array without swapping any elements. This is called bubble sort because it is like bubble, the big numbers floats up to the top.

## How to find simple linear regression?

If you are given a list of X and Y values, that are the coordinates of points on a graph. How do you find a single straight line that fits the points such that the straight line is the best match for the points?

We will make use of two equations:

and

where

is the average of x values of all coordinates,

is the average of y values of all coordinates,

is the standard deviation of y values of all coordinates,

is the standard deviation of y values of all coordinates,

can be found using the second equation.

Rearranging the first equation, we get

This is the equation of the linear regression. f and x are variable, and we are finding the gradient, K and intercept, B which are and respectively.

Reference: https://en.wikipedia.org/wiki/Simple_linear_regression

## How to add new location to Facebook?

Sometimes you are at some place and you want to tag the place as your status update, but found that the place does not exist yet in Facebook, you can follow the steps below to add new location to Facebook:

Note: Adding new location to Facebook can only be done through mobile.

**Step 1**: At your news feed, click on status.

**Step 2**: Click check in.

**Step 3**: Type in your new location name e.g. Shaun tower.

**Step 4**: Click on “Add a new place”.

**Step 5**: Choose a category for your new location.

**Step 6**: Fill in the information (different information depending on the category you chose).

That’s all!

## How to disable Google analytics for admin?

Google analytics track admin’s count in addition to the visitor’s count. If you are a small blog or website owner, this poses a problem because your (admin) own visits could skew the statistics of Google Analytics. To solve this, add the following code:

1 2 3 4 5 6 |
<?php if (!is_super_admin()) : ?> <script> // insert your google analytics code below </script> <?php endif; ?> |

## Introduction to the Internet of Things and Embedded Systems, UCI Week 1: What Is the Internet of Things (IoT)?

I am taking Introduction to the Internet of Things (IoT) and Embedded Systems by University of California, Irvine on Coursera. Before I continue, I had to say that you cannot take the quizes and assignments if you are not premium member, which takes the fun away. I am still taking because I want to watch the videos and some PDF readings.

On Week 1, the instructor, Professor Ian Harris gave an overview of what IoT is. IoT are normal things like refrigerator, added with computational intelligence (chip), that can connect to the internet. Then, he explain the concept of IoT in a refrigerator. You can imagine the things around you that can possibly be turned into IoT.

The difference between IoT and computer is, IoT is more specialized for the task e.g. cooling food, driving, etc while computer is more general, it can run many programs for different tasks.

There are trends that have hasten the adoption of IoT, namely the decrease cost, size, weight of chips/ computers, the increase in computational speed, ability, the existence of internet and wide adoption of internet, wireless access, decrease in data cost and increase in data bandwidth. These are huge improvements!

Society can benefits from IoT because it makes thing easier, less dependent on humans, access to the wider world.

There are certainly risks, privacy and security issues involved. Social isolation, privacy (company keeping track of watching habits, health data), security (hacking health devices).

I think this course goes good hand in hand with the network communications (SCSR1213 UTM SPACE) course I am taking in university, especially the internet part.

## The Master Algorithm by Pedro Domingos

I am interested in machine learning and deep learning and this book gave an overview of the field for me.

Machine learning can be categorized into 5 groups, symbolists, connectionists, evolutionaries, bayesians, and analogizers.

All are looking to ways to simulate intelligence in machines by learning.

Symbolists are the pure math type, using logic to solve intelligence. Their weapon is the reverse deduction or induction. Linear regression and gradient descent are under this category.

Connectionists get their inspiration from the brain, namely neurons. Their weapon is the neural networks. Deep learning is under this category.

Evolutionaries tries to emulate evolution. Since mother nature can produce intelligence, we simulate the way she did it. Genetic algorithm is under this category.

Bayesians use probability. You attach probabilities to event, and the event is more probably if it occurs many times. Bayesian network and Markov network are under this category.

Analogizers use similarity function. Things that are similar tends to be alike. The famous nearest neighbour algorithm and Support Vector Machine (SVM) are under this category.

There are ways to combine methods of these 5 categories, namely stacking, bagging (e.g. random forest), boosting.

Also, the master algorithm unifying these 5 categories.