Added functions for quant distance algorithm. main function: compareTreesByLevel