Faster reduce tree algorithm