# Expedient stochastic move-to-front and optimal stochastic move-to-rear list organizing strategies

## Abstract

Consider a list of elements {R_{1},...R_{N}} in which the element R_{i} is accessed with an (unknown) probability s_{i}. If the cost of accessing R_{i} is proportional to i (as in sequently search) then it is advantageous if each access is accompanied by a simple reordering operation. This operation is chosen so that ultimately the list will be sorted in the descending order of the access probabilities.

In this paper we present two list organizing schemes — the first of which uses bounded memory and the second which uses memory proportional to number of elements in the list. Both of the schemes reorder the list by moving only the accessed element. However, as opposed to the schemes discussed in the literature the move operation is performed stochastically in such a way that ultimately no more move operations are performed. When this occurs we say that the scheme has converged. We shall show that:

- (i)
The bounded memory stochastic move-to-front algorithm is expedient, but is always worse than the deterministic move-to-front algorithm.

- (ii)
The linear-memory stochastic move-to-rear scheme is optimal, independent of the distribution of the access probabilities. By this we mean that although the list could converge to one of its N! configurations, by suitably updating the probability of performing the move-to-rear operation, the probability of converging to the right arrangement can be made as close to unity as desired.

## Keywords

Dynamic list ordering move to front rule adaptive learning self-organizing lists stochastic list operations## Preview

Unable to display preview. Download preview PDF.

## References

- [1]Arnow, D.M. and Tenebaum, A.M., "An Investigation of the Move-Ahead-K Rules", Congressus Numerantium, Proc. of the Thirteenth Southeastern Conference on Combinatorics, Graph Theory and Computing, Florida, February 1982, pp. 47–65.Google Scholar
- [2]Bitner, J.R., "Heuristics That Dynamically Orgnize Data Structures", SIAM J. Comput., Vol. 8, 1979, pp.82–110.Google Scholar
- [3]Burville, P.J. and Kingman, J.F.C., "On A Model for Storage and Search", J. Appl. Probability, Vol.10, 1973, pp.697–701.Google Scholar
- [4]Cook, C.R., and Kim, D.J., "Best Sorting Algorithm for Nearly Sorted Lists", Comm. ACM, Vol.23, 1980, pp.620–624.Google Scholar
- [5]Dijkstra, E.W., "Smoothsort, An Algorithm for Sorting in SITU", Science of Computer Programming, 1982, pp.223–233.Google Scholar
- [6]Gonnet, G.H., Munro, J.I. and Suwanda, H., "Exegesis of Self Organizing Linear Search", SIAM J. Comput., Vol.10, 1981, pp.613–637.Google Scholar
- [7]Hendricks, W.J., "The Stationary Distribution of an Interesting Markov Chain", J. Appl. Probability, Vol.9, 1972, pp.231–233.Google Scholar
- [8]Hendricks, W.J., "An Extension of a Theorem Concerning an Interesting Markov Chain", J. App. Probability, Vol.10, 1973, pp.231–233.Google Scholar
- [9]Kan, Y.C. and Ross, S.M., "Optimal List Order Under Partial Memory Constraints", J. App. Probability, Vol.17, 1980, 1004–1015.Google Scholar
- [10]Karlin, S. and Taylor, H.M., "A First Course in Stochastic Processes", Academic Press, 1975.Google Scholar
- [11]Knuth, D.E., "The Art of Computer Programming, Vol.3, Sorting and Searching", Addison-Wesley, Reading, Ma., 1973.Google Scholar
- [12]McCabe, J., "On Serial Files With Relocatable Records", Operations Research, Vol.12, 1965, pp.609–618.Google Scholar
- [13]Rivest, R.L., "On Self-Organizing Sequential Search Heuristics", Comm. ACM, Vol.19, 1976, pp.63–67.Google Scholar
- [14]Sleator, D. and Tarjan, R., "Amortized Efficiency of List Update Rules", Proc. of the Sixteenth Annual ACM Symposium on Theory of Computing, April 1984, pp.488–492.Google Scholar
- [15]Tenenbaum, A.M. and Nemes, R.M., "Two Spectra of Self-Organizing Sequential Search Algorithms", SIAM J. Comput., Vol.11, 1982, pp.557–566.Google Scholar
- [16]Oommen, B.J., "On the Use of Smoothsort and Stochastic Move-to-Front Operations for Optimal List Organization", Proc. of the Twenty-Second Allerton Conference on Communication, Control and Computing, October 1984, pp.243–252.Google Scholar
- [17]Titchmarsh, E.C., The Theory of Functions, Oxford University Press, 1964.Google Scholar