Two sided Hausdorff distance is calculated as
$H(r_1,r_2)=\max\{h(r_1,r_2),h(r_2,r_1)\}$
where
$h(r_1,r_2)=\max_{a \in r_1}\min_{b\in r_2}\|r_1-r_2\|$ and vice-verse
$r_1$ and $r_2$ are two non empty, finite sets
This when programmed will take $O(n^2)$ time
Is there a better algorithm so that the time complexity is reduced? I need this to use in my project for finding the diffence between two images