Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site wateng.UUCP Path: utzoo!watmath!wateng!pdbain From: pdbain@wateng.UUCP (Peter Bain) Newsgroups: net.lang,net.lang.pascal Subject: Why compare pointers in Pascal? Message-ID: <1920@wateng.UUCP> Date: Mon, 28-Jan-85 11:17:13 EST Article-I.D.: wateng.1920 Posted: Mon Jan 28 11:17:13 1985 Date-Received: Tue, 29-Jan-85 05:41:39 EST References: <3161@ucla-cs.ARPA> <335@snow.UUCP> Reply-To: pdbain@wateng.UUCP (Peter Bain) Organization: U of Waterloo, Ontario Lines: 11 Xref: watmath net.lang:1317 net.lang.pascal:210 Summary: Say I had a set of records, which I represented as a vector of pointers. Suppose further that I wanted to test for set membership by comparing pointers. If I keep the vector sorted by increasing pointer value, I can do the test in O(lg(N)), using a binary search, but I need < and > on pointers. If all I have is == and !=, it takes O(N) time. -- - peter bain ...!{allegra|decvax|clyde|ihnp4 }!watmath!wateng!pdbain hard mail: CCNG, CPH-2369A, University of Waterloo, Waterloo, Ont. Canada N2M 5G4 telephone: (519) 885-1211 x2810