■ VBH HUBUraBB H ^■nX v*-' BMnnMH Mi I UBi ■ME Rfl ■n Bfl ■L B3Q IS «89 bu m Bj H in S BE Hn ORB HOBS H9 wSBm MM BlfHllnfl HtWfiT m BBIHl HllBil IS H BB ■ WlM M t is LIBRARY OF THE UNIVERSITY OF ILLINOIS AT URBANA-CHAMPAIGN 510. 84- I46r cop.2 uiucdcs-r-t 1 +-667 ON FINDING THE MAXIMAL ELEMENTS IN A SET OF PLANE VECTORS by Foong Frances Yao July, 197U I he LIBRARY OF Trie. APR1 1975 UNIVERSlT op ILUNO! DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF ILLINOIS AT URBANA-CHAMPAIGN URBANA, ILLINOIS uiucdcs-r-t 1 +-66t ON FINDING THE MAXIMAL ELEMENTS IN A SET OF PLANE VECTORS By Foong Frances Yao July, 197^ DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF ILLINOIS AT URBANA-CHAMPAIGN URBANA, ILLINOIS 6l801 *Supported in part by the National Science Foundation under contract NSF GJ U1538, Digitized by the Internet Archive in 2013 http://archive.org/details/onfindingmaximal667yaof JJKof *»6£7-£72- Abstract Let F be a set of n vectors in the plane . A partial order is defined on F in a natural manner. It is known that the maximal elements of F can be found in S(n) + n-1 comparisons, where S(n) is the minimum number of comparisons required to sort n numbers. In this note we show that S(n) + n-1 comparisons are necessary. 1. Introduction Let F = {(x.,y.)| i=l,2,...,n} be a set of n distinct vectors in the plane. A vector (x.y. )eF is said to be an maximal element of F if for any (x.,y.)eF where 1 < J <_n and jfi, we have either x. < x or y . < y. . (max) We will use F to denote the set of maximal elements of F As noted by Luccio and Preparata [l], it is possible to find F by using no more than S(n)+n-l pairwise comparisons among the numbers {x ,x , ...,x ,y, ,y p , . . . ,y }, where S(n) is the minimax number of comparisons for sorting n numbers. If we denote by V(n) the minimum number of comparisons required to find F for any set F of n vectors, we will show that V(n) ^ S(n) + n-1 (l) In fact we will prove that S(n) + n-1 comparisons are necessary even for algorithms whose input is restricted to those F's satisfying x. > y. for all 1 <_ i, j <_ n. Under this restriction, we can assume that the algorithms to be considered contain only comparisons of the form x.:x or of the form l J y :y . Let ,4- be any such algorithm. If T, is the decision of A>, we will & a. A- show that some subtree T' of T is isomorphic to the decision tree T* of a sorting algorithm jS (for n numbers). This implies that V(n) >_S(n). The algorithm .*#, however, is not an optimal sorting algorithm. In fact, the height of T» can be reduced by n-1 when some redundant comparisons are re- moved. This then leads to V(n) >. S(n) + n-1. Details of the above scheme of proof are given in the next two sections. 2. Definition of T! Let us consider those sets of vectors F = {(x. ,y. )|l <_ i <_ n} with the property x. > x. iff y. < y. for all i,j. (2) For F satisfying (2), all n vectors are maximal elements. The following lemma is essential to the proof of (l) in the next section. Lemma ) Let A he an algorithm for finding maximal vectors. If F satisfies (2), then there exists a permutation (i,i ,...,! ) of (l,2,...,n) such that when A- is applied to F, the following statements are ture: (i) Algorithm A- establishes x. > x. > ...>x. and y. < y. < ... x.)A(y. < y.) or (x. y.). Therefore (3) is true. All the comparisons in (h) have to be made since they are necessary for establishing (3). □ We now turn to the definition of T! as mentioned in Sec. 1. Let A- rf-be an algorithm for finding maximal vectors and T. its decision tree. For A any input F, there is a unique path in T. which determines the actual com- A- puting process when £ is applied to F. We shall say it is the path traversed by F. 3 Definition 1 For any algorithm A that finds maximal vectors, T\ is defined to be the subtree of T\ consisting of all those paths traversed by the F's n- satisfying (2). 3. Constructing a sorting algorithm from T' Let Tl be the subtree obtained from T. as in Definition 1. We will 4 4 transform T' into the decision tree T , for an algorithm d which sorts n num- bers . Definition 2 Let {z n ,z r ,...,z } represent n distinct numbers. We define a 12 n new decision tree Tp based on Tj as follows: (i) Replace any comparison of the form x.:x. at an internal node of T! with z.:z.. Also replace the branching labels x. > x. and x. < x. on i J l j l j the arcs with z. > z. and z. < z. respectively, i J i J (ii) Replace any comparison y.:y. by z.:z.. However, the branching label J J y. > y. is replaced by z. < z. while y. < y. is replaced by z. > z.. i j ij i ,3 ^ i j (iii) Leave the external nodes blank at present. We will show that the tree T» so obtained indeed represents a sorting algorithm. But first note that the tree structures of T» and T! are isomer- 's A phic in a natural way. Let us denote by a this isomorphic mapping from T' onto T». If N is a node performing x.:x. in T ' , then a(N) is a node in T# A 1 J ,4. A performing z.:z.. Similarly if C is an arc in T' with branching label y. > y., then a(c) is an arc in T- with branching label z. < z.. For a set P of nodes » l j and arcs in TJ , we shall also use a(P) to denote the set of corresponding nodes A- and arcs in T.. The following lemma is obvious from the definition of T». Lemma 2 . Let Z = {z.,z~,...,z } be a set of n distinct numbers, and 1 2 n F = {(x.,y.)| i = 1,2,..., n} be a set of vectors satisfying (2). Moreover, assume that x. > x. , y. < y. iff z. > z. for all i , j . (5) i J i J i J Then the pathP traversed by Z in T. corresponds to the path Q traversed by F in TJ in the sense that P = a(Q). Lemma 2 implies that, if x.:x. (or y.:y.) is performed when ^- is applied to F, then z.:z. is performed when J is applied to Z for F,Z satisfying (5). We are now ready to prove that xf is a sorting algorithm. Theorem 1 (i) uf is a sorting algorithm for Z = {z ,z p ,...,z }. (ii) For any input Z, there are n-1 comparisons each of which is performed twice in xf. Proof : Consider any set of n distinct numbers Z = {z ,z ,...,z }. Assume z. >z. >...>z. . Now consider the following set of vectors: 1 2 n F = {(x.,y. )| lx. > ...>x. andy. 12 n 12 n When >4- i s applied to F, the comparisons x. :x. x. :x. ... x. :x. 'li'\ y i ? :y i, • • • y i = y i (6) 12 2 3 n-1 n are performed according to Lemma 1. Therefore, when xf is applied to Z, each of the n-1 comparisons z. : z . z. : z. ... z. : z. (7) X l ^ X ~ 2 X 2 X 3 ^-1 X n will be performed twice (duplicate imagesof x. :x. and y. :y. under 1 k X k+1 x k x k+l mapping a) by Lemma 2 and (6). Since the comparisons in (7) suffice to extablish z. >z. >...>z. ,we have sorted Z. PI 12 n As a result of Theorem 1, we can clearly remove the redundant com- parisons from ^ to obtain a sorting algorithm which makes n-1 fewer comparisons than )/ for any input Z = {z ,z ,...,z }. This shows that the height h« of l c. n >o T» satisfies h. >_ S(n) + n-1. On the other hand, since T is isormorphic to a subtree of T. , the height h. of T must then satisfy 'A- j4- h. > S(n) + n-1. (8) A ~ Since (8) is true for any algorithm ■£■ that finds the maximal vectors, we thus obtain our main result: Theorem 2 V(n) > S(n) + n-1 As mentioned in Sec. 1, S(n) + n-1 is an upper bound for V(n) since (max) F can be found by sorting the vectors of F into non-increasing order by their first coordinates, and then making a sequential search on their second coordinates. Therefore we have V(n) = S(n) + n-1. Acknowledgement H.T. Kung has also considered this problem independently in [2] and obtained a weaker result. REFERENCES [l] Luccio, F., and Preparata, F.P. , On Finding the Maxima of a Set of Vectors, Instituto di Scienze dell'Informazione, Universita. di Pisa, Corso Italia Uo, 56lOO Pisa, Italy, 1973. [2] Kung, H.T., On the Computational Complexity of Finding the Maxima of a Set of Vectors, 15th Annual Symposium of SWAT, October, 19lh. BLIOGRAPHIC DATA IEET 1. Report No. UIUCDCS-R-7U-667 2. (Title and Subtitle On Finding the Maximal Elements in a Set of Plane Vectors 3. Recipient's Accession No. 5. Report Date July, 197 *+ Author(s) Foong Frances Yao 8. Performing Organization Rept. N °" UIUCDCS-R-7U-667 Performing Organization Name and Address University of Illinois Department of Computer Science Urbana, IL 6l801 10. Project/Task/Work Unit No. 11. Contract /Grant No. NSF GJ U1538 Sponsoring Organization Name and Address National Science Foundation 1800 G St. N.W. Washington, D.C. 20550 13. Type of Report & Period Covered 14. Supplementary Notes Abstracts Let F be a set of n vectors in the plane. A partial order is defined on F in a natural manner. It is known that the maximal elements of F can be found in S(n) + n-1 comparisons, where S(n) is the minimum number of compari- sons required to sort n numbers. In this note we show that S(n) + n-1 comparisons are necessary. Key Words and Document Analysis. 17a. Descriptors Maximal element, decision tree b. Identifiers/Open-Ended Terms c. COSAT1 Field/Group Availability Statement Unlimited 19. Security Class (This Report) UNCLASSIFIED 20. Security Class (This Page UNCLASSIFIED 21. No. of Pages 10 22. Price CM NTIS-3S ( 10-70) USCOMM-DC 40329-P7 1 ui UNIVERSITY OF ILLINOIS-URBANA 510 84 I16H no COO? no 667 872(1974 R«porW 3 0112 088401382 - 1 mm ^'i# I ■ ■ ■ I "£r! ■p ^^^k '■%.: ^MaWMu ■ H 1 1 H ■ I ^ ■^ n - . * ■ 3C I ■ HHH8Bn I ■