Least common ancestor search in binary tree non recursive version - Java
问题 I am searching a non recursive algorithm version of finding the least common ancestor in a sorted binary tree written in Java. Everything I found is only the recursive version (even on stackoverflow and on other websites). Can some one write or direct me to the non recursive version (using while loop)? Also write if this version is more efficient in terms of time complexity? 回答1: Just happened to see this long forgotten question. Do you mean something like, if you are given a tree: A B C D E