implementation of searching in complete search tree