Updated code to output a string of binary and output the leaves in bfs
order