Software AG Interview Question

Theta Stack Max next number from array in 1 iteration swap nodes on the same level in tree