finished question4.1 with brute force method;used ctcilibrary to
generate tree to test, so can only be tested in eclipse with ctcilibrary