Another way of proving the time complexity of first approach is O(nlogn) using Master Theory:

Time complexity for depth:

T(n) = 2T(n/2) + O(1)

a = 2, b =2, d = 0

a > b^d, therefore, O(n^(logba)) = O(n)

Time complexity for isBalanced:

T(n) = 2T(n/2) + O(n)

a = 2, b =2, d = 1

a = b^d, therefore, O(n^d*logn) = O(nlogn)