Abstract

We introduce a sorting machine consisting of $k+1$ stacks in series: the first $k$ stacks can only contain elements in decreasing order from top to bottom, while the last one has the opposite restriction. This device generalizes the $\mathfrak{DI}$ machine introduced by Rebecca Smith, which studies the case $k=1$. Here we show that, for $k=2$, the set of sortable permutations is a class with infinite basis, by explicitly finding an antichain of minimal nonsortable permutations. This construction can easily be adapted to each $k\geqslant 3$. Next we describe an optimal sorting algorithm, again for the case $k=2$. We then analyze two types of left-greedy sorting procedures, obtaining complete results in one case and only some partial results in the other one. We close the paper by discussing a few open questions.

Highlights

  • The problem of sorting a permutation using a stack was first introduced by Knuth [12] in the 1960s; in its classical formulation, the aim is to sort a permutation using a firstin/last-out device

  • In the language of permutation patterns, we say that the set of sortable permutations is a class with basis {231}, meaning that each of these permutations cannot contain the pattern 231 as a subpermutation; a class is a downset in the permutation pattern poset and each

  • F. are members of the INdAM Research group GNCS; they are partially supported by INdAM - GNCS 2019 project “Studio di proprietacombinatoriche di linguaggi formali ispirate dalla biologia e da strutture bidimensionali” and by a grant of the “Fondazione della Cassa di Risparmio di Firenze” for the project “Rilevamento di pattern: applicazioni a memorizzazione basata sul DNA, evoluzione del genoma, scelta sociale”

Read more

Summary

Introduction

The problem of sorting a permutation using a stack was first introduced by Knuth [12] in the 1960s; in its classical formulation, the aim is to sort a permutation using a firstin/last-out device. We provide an optimal algorithm to sort permutations, again in the case of two decreasing stacks followed by an increasing one. We observe that the optimal sorting strategy here would be, at each step, to push the maximum and second maximum element still available into I; in the general case, this strategy fails since 3 remains stuck in D1, blocked by a larger element in D2, until we reach the final portion of α(j). This crucial remark will be useful in the last part of this proof. Theorem 4 remains true if we permute the elements 1,2,3 of α(j), for every j

An optimal algorithm for the D2I-machine
Some further algorithms
A left-greedy algorithm
Final remarks
Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call