Issue |
RAIRO-Theor. Inf. Appl.
Volume 58, 2024
Randomness and Combinatorics - Edited by Luca Ferrari & Paolo Massazza
|
|
---|---|---|
Article Number | 13 | |
Number of page(s) | 14 | |
DOI | https://doi.org/10.1051/ita/2024010 | |
Published online | 09 April 2024 |
Sorting with a popqueue
Dipartimento di Matematica e Informatica “U. Dini”, University of Firenze, Firenze, Italy
* Corresponding author: luca.ferrari@unifi.it
Received:
12
December
2022
Accepted:
23
February
2024
We introduce a new sorting device for permutations, which we call popqueue. It consists of a special queue, having the property that any time one wants to extract elements from the queue, actually all the elements currently in the queue are poured into the output. We illustrate two distinct optimal algorithms, called Min and Cons, to sort a permutation using such a device, which allow us also to characterize sortable permutations in terms of pattern avoidance. We next investigate what happens by making two passes through a popqueue, showing that the set of sortable permutations is not a class for Min, whereas it is for Cons. In the latter case we also explicitly find the basis of the class of sortable permutations. Finally, we study preimages under Cons (by means of an equivalent version of the algorithm), and find a characterization of the set of preimages of a given permutation. We also give some enumerative results concerning the number of permutations having k preimages, for k = 1, 2, 3, and we conclude by observing that there exist permutations having k preimages for any value of k ≥ 0.
Mathematics Subject Classification: 05A05 / 68R05 / 68W32
Key words: Sorting algorithm / popqueue / enumeration / pattern avoidance / permutation
© The authors. Published by EDP Sciences, 2024
This is an Open Access article distributed under the terms of the Creative Commons Attribution License (https://creativecommons.org/licenses/by/4.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.
Current usage metrics show cumulative count of Article Views (full-text article views including HTML views, PDF and ePub downloads, according to the available data) and Abstracts Views on Vision4Press platform.
Data correspond to usage on the plateform after 2015. The current usage metrics is available 48-96 hours after online publication and is updated daily on week days.
Initial download of the metrics may take a while.