Given two balanced binary search trees $T_1,T_2$. We want to check, are $T_1\subseteq T_1$ or not. $T_1$ have $n_1$ nodes, and $T_2$ have $n_2$ nodes.
Instructor say it can be done in $O(n_1+n_2)$ time complexity with $O(\log n_1+\log n_2)$ space.
My idea:
I use in order traverse on two trees , and compare first node in order traverse $T_1$ with first node in in order traverse $T_2$, and etc. if all nodes in $T_1$ present in $T_2$ then we say $T_1\subseteq T_2$, but i can't prove my space complexity followed from mentioned complexity. Any one can help to guarantee my space complexity be $O(\log n_1+\log n_2)$.