Proxify interview question

Sort a binary tree in javascript