Well normally if using depth-first traversal, we get O(n) time. However, if we find the minimum element first then call the successor() method n times, what time complexity will it be?
I think it may be O(n log n) because successor is O(log n) but that doesn’t seem right. Can anyone offer any in-depth analysis here (probably involving some limit analysis)?
If parent pointers are present at each node, calling the successor method n times takes O(n) time. To see this observe that each edge in the tree gets visited at most twice (once from parent to child and once from child to the parent) by all the successor calls combined. Thus the total number of edges visited by all the successor calls is at most 2n. So the running time is O(n).
Now if parent pointers are not present, in every call we have to start from the root and search for the successor element by travelling through O(log n) nodes (if the tree is balanced). So the complexity becomes O(n log n).