correct problem18. tree+list