I implemented maximum depth both using queue and recursion. Although I think the time complexity are both O(n), but isn't recursion more expensive and time-consuming? From the running time of results, it turned out using queue cost more time, what cause this? because there aren't many test cases?

Thanks.