The idea is very good. Just traverse all nodes and find the secondMin. But, your efficiency is not very high, because you don't make advantage of the feature of the tree. Each root is no smaller than it's children. So in every case, the time complexity is O(N), where N is the number of nodes. But, when using DFS, we can cut half of the tree, when the value of two sub trees' root' values are not identical. So, the time complexity of DFS is O(N) only in worst case, on average, it's O(log(n)). Hope it helps.