3
4

1 回答 1

2

It sounds like you could use a disjoint-set-forest that the terms would be members of. This has efficient union/find.

http://en.wikipedia.org/wiki/Disjoint-set_data_structure#Disjoint-set_forests

A bit of googling reaffirms that this is used in prolog unification implementations.

http://docs.lib.purdue.edu/cgi/viewcontent.cgi?article=2318&context=cstech

于 2015-04-09T15:14:08.887 回答