Question: I saw following code on c++ reference:
`bool operator() (const int& lhs, const int&rhs) const`
What does the last const do?

Answer: 
A bit more of details then:

1. Set K to the desired number of clusters, lets use 2.
2. Choose randomly K entities to be the medoids m\_1, m\_2. Lets choose X\_3 (Lets call this cluster 1) and X\_5 (Cluster 2).
3. Assign a given entity to the cluster represented by its closest medoid. Cluster 1 will be made of entities (X\_1, X\_2, X\_3 - just check your table, these are closer to X\_3 than to X\_5), cluster 2 will be (X\_4, X\_5, X\_6).
4. Update the medoids. A medoid of a cluster should be the entity with the smallest sum of distances to all other entities within the same cluster. X\_2 will be the new medoid for cluster 1, and X\_4 for cluster 2.

Now what you have to do repeat steps 3-4 until convergence. So,

5- Assign each entity to the cluster of the closest medoid (now these are X\_2 and X\_4). Cluster one is now made of entities (X\_1, X\_2, X\_3 and X\_6), Cluster 2 will be (X\_4, X\_5).
(there was a change in the entities in each cluster, so iterations must continue.

6- The entity with the smallest sum of distances in cluster one is still X\_2, in cluster 2 they are the same, so x\_4 stays.

Another iteration

7- As there was no change in the medoids, the clusters will stay the same. This means its time to stop the iterations

Output: 2 clusters. Cluster 1 has entities (X\_1, X\_2, X\_3, X\_6), and cluster 2 has entities (X\_4 and X\_5).

Now, if I had started this using different initial medoids maybe I'd get a different clustering... you may wish to check the build algorithm for initialisation.
You have clusters C1 and C2 given.

1. Find the most central element in each cluster.
2. Compute new C1 and C2.
3. Repeat 1. and 2. until convergence