A Fast Equivalence-Checking Algorithm for Circular Lists

We assume that the elements of A and B are wellordered so that any comparison between two elements a and b yields one of the three results a < b, c > b, or a = b. Furthermore, we will assume (without loss of generality) that these elements are real numbers and the order is the natural one. In this paper we present an algorithm that usetl at most 3n 3 comparisons in order to check equivalence. Our algorithm not only deals with a very fundamental data-processing problem but also has immediate applications to other problems. It can be used for exam;$e to improve the time bounds of the problem of checking similarity of two polygons. The prescrnt most efficient algorithms that solve this problem [I 4, employ the fast pattern-matching algorithm of Knuth, Morris, and Pratt [3] to check equivalence of two circular lists. The KMP algorithm, when