A Tree Pattern Matching Algorithm with Reasonable Space Requirements