Optimizing CLINK to O((n^2)logn) using balanced BST as a Priority Queue