finished tree2.c