All posts in 'algorithm'

Travelling Salesman Problem

Introduction In the previous post, I introduced you the concepts of NP problem. Travelling Salesman Problem (or TSP) is one of them. I’ll take its definition from Wikipedia: The travelling salesman prob...     Read more »

NP Problems

Recently I was asked to research something called NP problem. NP stands for Non-deterministic Polynomial time. In simple term, it’s a category of algorithms that we can not calculate its run time (in regular...     Read more »

Using KMeans to cluster 1D data

Problem: Given the following set: { 2, 4, 10, 12, 3, 20, 30, 11, 25 }. Write pseudo code for k-means clustering algorithm to cluster the above set to 2 clusters. Then implement code to achieve the same. ...     Read more »