Algorithm. The K-medians algorithm is simply the K-means algorithm, using cityblock distance and me- dian in place of squared Euclidean distance and mean. Thus, any of the K-means algorithm variations pre- sented (individual-reassignment, batch, or combined) can be used with K-medians. Mediandefinition. If the number of observations (N) is odd, the sample median is the observation in the middle of an orderedlist of observations. If the number of observations is even, the sample median is the mean of the two middle observations (Weiss, 2002). A cluster median is the vector of the cluster-wise medians for each variable (attribute). For a group of observations with more than one variable, the cluster median is a vector of the group-wise medians for each variable (attribute).