I have a map $f:X\to \mathbb{N}$ and I wish to find $x,x'\in X$ such that $f(x)=f(x')$. Since such elements are rare, I will have to check very many elements and perform many comparisons, so I suspect the best way to do this is using an ordered tree data structure, which stores elements $x\in X$ by comparing their values $f(x)$, and tells if an element with same value is already in the tree.
Is there an OrderedTree data structure (or something similar, e.g. ordered list) implemented in Mathematica?
f
(quotes because it is multivalued), and any time one was encountered for somex'
, you'd have your correspondingx
stored. $\endgroup$y=StringTake[IntegerString[Hash[x,"SHA256"],16],-13];]
wherex=ToString@RandomInteger[1,1000000]
. $\endgroup$f
viaDownValues
. Any suggestions? $\endgroup$X
....? $\endgroup$