verified algorithm to find the last node in an almost full binary tree