We show a relationship between the number of comparisons and the number of I/O operations needed to solve a given problem. We work in a model, where the permitted operations are l/O-operations and comparisons of two records in internal memory. An I/O- operation swaps <em>B</em> records between external memory and the internal memory (capable of holding <em>M</em> records). An algorithm for this model is called an I/O-algorithm. The main result of this paper is the following: Given an I/O-algorithm that solves an n-record problem P_n using I/O(bar{x}) I/O's on the input bar{x}, there exists an ordinary comparison algorithm that uses no more than <em>n</em> logB + I/O(bar{x}) € T_{merge}(M-B, B) comparisons on input bar{x}. T_{merge}(n, m) denotes the number of comparisons needed to merge two sorted lists of size n and m, respectively. We use the result to show lower bounds on the number of I/O-operations needed to solve the problems of sorting, removing duplicates from a multiset and determining the mode (the most frequently occurring element in a multiset). Aggarwal and Vitter have shown that the sorting bound is tight. We show the same result for the two other problems, by providing optimal algorithms.
scite is a Brooklyn-based organization that helps researchers better discover and understand research articles through Smart Citations–citations that display the context of the citation and describe whether the article provides supporting or contrasting evidence. scite is used by students and researchers from around the world and is funded in part by the National Science Foundation and the National Institute on Drug Abuse of the National Institutes of Health.