binarysearch of tree element -> get element by index=entitiy code