Programming Techniques for Reversible Comparison Sorts
- Cite this paper as:
- Axelsen H.B., Yokoyama T. (2015) Programming Techniques for Reversible Comparison Sorts. In: Feng X., Park S. (eds) Programming Languages and Systems. Lecture Notes in Computer Science, vol 9458. Springer, Cham
A common approach to reversible programming is to reversibly simulate an irreversible program with the desired functionality, which in general puts additional pressure on the computational resources (time, space.) If the same running time is required, ensuring a minimal space overhead is a significant programming challenge.
We introduce criteria for the optimality of reversible simulation: A reversible simulation is faithful if it incurs no asymptotic time overhead and bounds the space overhead (the garbage) by some function g(n), and hygienic if g is (asymptotically) optimal for faithful simulation.
We demonstrate the programming techniques used to develop faithful and hygienic reversible simulations of several well-known comparison sorts, e.g. insertion sort and quicksort, using representations of permutations in both the output and intermediate additional space required.