implemented Uniform Cost Search
refactored to use a generic templated search function