I used the dist
function in R and I am wondering the time complexity of it.
I know that the hierarchical clustering has a N^2*logN
time complexity. And hierarchical clustering is composed of two parts as below codes in R.
> d <- dist(as.matrix(mtcars)) # find distance matrix
> hc <- hclust(d) # apply hirarchical clustering
> plot(hc) # plot the dendrogram
before applying hierarchical clustering, calculating the distance matrix is required. I think this takes N^2
complexity?