Optimal Resilient Sorting and Searching in the Presence of Memory Faults ∗ Irene Finocchi † Fabrizio Grandoni ‡ Giuseppe F. Italiano ‡ Abstract We investigate the problem of reliable computation in the presence of faults that may arbitrarily corrupt memory locations. In this framework, we consider the problems of sorting and searching in optimal time while tolerating the largest possible number of memory faults. In particular, we design an O(n log n) time sorting algorithm that can optimally tolerate up to O( √ n log n ) memory faults. In the special case of integer sorting, we present an algorithm with linear expected running time that can tolerate O( √ n ) faults. We also present a randomized searching algorithm that can optimally tolerate up to O(log n) memory faults in O(log n) expected time, and an almost optimal deterministic searching algorithm that can tolerate O((log n) 1-ǫ ) faults, for any small positive constant ǫ, in O(log n) worst-case time. All these results improve over previous bounds. Keywords: combinatorial algorithms, sorting, searching, memory faults, memory models, computing with unreliable information. 1 Introduction The need for reliable computations in the presence of memory faults arises in many important applications. In fault-based cryptanalysis, for instance, some optical and electromagnetic perturbation attacks [6, 32] work by manipulating the non-volatile memories of cryptographic devices, so as to induce very timing-precise controlled faults on given individual bits: this forces the devices to output wrong ciphertexts that may allow the attacker to determine the secret keys used during the encryption. Induced memory errors have been effectively used in order to break cryptographic protocols [6, 7, 35], smart cards and other security processors [1, 2, 32], and to take control over a Java Virtual Machine [19]. Applications that make use of large memory capacities at low cost also incur problems of memory faults and reliable computation. Indeed, soft memory errors due to power failures, ∗ This work has been partially supported by the Sixth Framework Programme of the EU under Contract Number 507613 (Network of Excellence “EuroNGI: Designing and Engineering of the Next Generation Inter- net”) and by MIUR, the Italian Ministry of Education, University and Research, under Projects WEB MINDS (“Wide scalE Broadband MIddleware for Networks Distributed Services”) and ALGO-NEXT (“Algorithms for the Next Generation Internet and Web: Methodologies, Design and Experiments”). A preliminary version of this work was presented at the 33rd International Colloquium on Automata, Languages and Programming (ICALP’06). † Dipartimento di Informatica, “Sapienza” Universit`a di Roma, via Salaria 113, 00198, Roma, Italy. Email: finocchi@di.uniroma1.it. ‡ Dipartimento di Informatica, Sistemi e Produzione, Universit`a di Roma “Tor Vergata”, via del Politecnico 1, 00133 Roma, Italy. Email: {grandoni,italiano}@disp.uniroma2.it. 1