print_tree_bf included, maybe not optimal, as extra storage is necessary