implemented Tree and LinkedTree