\input{figures/pseudo-code/gac}
Greedy Agglomerative Clustering\cite{GAC}, GAC, is an agglomerative, bottom up clustering algorithm. GAC begins with the the entire training set. Each instance in the training set is a member in a cluster of size 1. Iteratively, GAC combines similar clusters using any similarity or distance metric. Each new cluster formed is marked as the parent cluster of the clusters it was formed from. This process creates a tree type structure, built from the bottom up. The leaves of this tree are the original data instances, while the inner nodes are clusters that contain all instances represented in its subtree. GAC only stops grouping clusters when there is only one cluster remaining, the root cluster, which contains all the training instances.

This tree structure provides an easy way to quickly query the data. With a tree structure, assuming an even distribution of data, each level traversed removes half of the data, resulting in a sub-linear querying runtime. This bottom up approach to building the tree has been shown to create higher quality clusters when compared to top-down tree clustering algorithms\cite{GAC}. By appraising each data point while forming the tree, the grouped instances are optimally paired. One drawback to this method is its runtime: $O(n^2)$\cite{GAC}.
