ISAAC 2008: Algorithms and Computation pp 895-906

# Sorting with Complete Networks of Stacks

• Felix G. König
• Marco E. Lübbecke
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5369)

## Abstract

Knuth introduced the problem of sorting numbers using a sequence of stacks. Tarjan extended this idea to sorting with acyclic networks of stacks (and queues), where items to be sorted move from a source through the network to a sink while they may be stored temporarily at nodes (the stacks). Both characterized which permutations are sortable this way; but they ignored the associated optimization problem (minimize the number of moves) and its complexity.

Given a complete, thus cyclic, network of k ≥ 2 stacks, any permutation is obviously sortable. The important question now is how to actually sort with a minimum number of shuffles, i.e., moves in between stacks. This is a natural algorithmic complement to the structural questions asked by Knuth, Tarjan, and others. It is the first time shuffles are considered in stack sorting—despite of the great practical importance of this optimization version.

We show that it is NP-hard to approximate the minimum number of shuffles within $$\mathcal{O}(n^{1-\epsilon})$$ for networks of k ≥ 4 stacks, even when the problem is restricted to complete networks, by relating stack sorting to Min k -Partition on circle graphs (for which we prove a stronger inapproximability result of independent interest). For complete networks, a simple merge sort algorithm achieves an approximation ratio of $$\mathcal{O}(n \log n)$$ for k ≥ 3; however, closing the logarithmic gap to our lower bound appears to be an intriguing open question. Yet, on the positive side, we present a tight approximation algorithm which computes a solution with a linear approximation guarantee, using a resource augmentation to αk + 1 stacks, given an α-approximation algorithm for coloring circle graphs.

When there are constraints as to which items may be placed on top of each other, deciding about sortability becomes non-trivial again. We show that this problem is PSPACE-complete, for every fixed k ≥ 3.

## Keywords

Chromatic Number Graph Coloring Color Class Complete Network Circle Graph
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

## References

1. 1.
Ageev, A.A.: Every circle graph of girth at least 5 is 3-colourable. Discrete Math. 195(1–3), 229–233 (1999)
2. 2.
Avriel, M., Penn, M., Shpirer, N.: Container ship stowage problem: complexity and connection to the coloring of circle graphs. Discrete Appl. Math. 103(1-3), 271–279 (2000)
3. 3.
Blasum, U., Bussieck, M., Hochstättler, W., Moll, C., Scheel, H., Winter, T.: Scheduling trams in the morning. Math. Methods Oper. Res. 49(1), 137–148 (1999)
4. 4.
Bóna, M.: A survey of stack-sorting disciplines. Electron. J. Comb. 9(2) (2002)Google Scholar
5. 5.
Černý, J.: Coloring circle graphs. Electr. Notes Discrete Math. 29, 457–461 (2007)
6. 6.
Cornelsen, S., Di Stefano, G.: Track assignment. J. Discrete Algorithms 5(2), 250–261 (2007)
7. 7.
Even, S., Itai, A.: Queues, stacks, and graphs. In: Proceedings of the International Symposium on the Theory of Machines and Computations, pp. 71–86. Academic Press, New York (1971)
8. 8.
Felsner, S., Pergel, M.: Sorting using networks of stacks and queues. In: Halperin, D., Mehlhorn, K. (eds.) ESA 2008. LNCS, vol. 5193, pp. 417–429. Springer, Heidelberg (2008)
9. 9.
Gallo, G., Di Miele, F.: Dispatching buses in parking depots. Transp. Sci. 35(3), 322–330 (2001)
10. 10.
Gavril, F.: Algorithms for a maximum clique and a maximum independent set of a circle graph. Networks 3(3), 261–273 (1973)
11. 11.
Golumbic, M.C.: Algorithmic Graph Theory and Perfect Graphs, 2nd edn. Elsevier B.V., Amsterdam (2004)
12. 12.
Gupta, N., Nau, D.S.: On the complexity of blocks-world planning. Artif. Intell. 56(2-3), 223–254 (1992)
13. 13.
Hearn, R.A., Demaine, E.D.: PSPACE-completeness of sliding-block puzzles and other problems through the nondeterministic constraint logic model of computation. Theor. Comput. Sci. 343(1–2), 72–96 (2005)
14. 14.
Kann, V., Khanna, S., Lagergren, J., Panconesi, A.: On the hardness of approximating max k-cut and its dual. Chic. J. Theor. Comput. Sci. (1997)Google Scholar
15. 15.
Knuth, D.E.: The Art of Computer Programming, Volume 3: Sorting and Searching, 2nd edn. Addison Wesley Longman, Amsterdam (1998)Google Scholar
16. 16.
König, F.G., Lübbecke, M.E., Möhring, R.H., Schäfer, G., Spenke, I.: Practical solutions to PSPACE-complete stacking. In: Proceedings of the 15th European Symposium on Algorithms. Lect. Notes Comput. Sci, vol. 4698, pp. 729–740. Springer, Heidelberg (2007)Google Scholar
17. 17.
Nilsson, N.J.: Principles of Artificial Intelligence. Morgan Kaufmann, San Francisco (1980)
18. 18.
Tarjan, R.: Sorting using networks of queues and stacks. J. ACM 19(2), 341–346 (1972)
19. 19.
Unger, W.: On the k-colouring of circle graphs. In: Cori, R., Wirsing, M. (eds.) STACS 1988. LNCS, vol. 294, pp. 61–72. Springer, Heidelberg (1988)