Sorting with Pop Stacks Stack sorting Pop stack sorting - - PowerPoint PPT Presentation

sorting with pop stacks
SMART_READER_LITE
LIVE PREVIEW

Sorting with Pop Stacks Stack sorting Pop stack sorting - - PowerPoint PPT Presentation

Sorting with Pop Stacks Lara Pudwell Sorting with Pop Stacks Stack sorting Pop stack sorting 1-pop-stack sortability 2-pop-stack sortability Polyominoes on a helix Lara Pudwell Width 2 Width 3 faculty.valpo.edu/lpudwell Wrapping up


slide-1
SLIDE 1

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Sorting with Pop Stacks Lara Pudwell

faculty.valpo.edu/lpudwell joint work with Rebecca Smith (SUNY - Brockport) Valparaiso MST Faculty Seminar March 21, 2017

slide-2
SLIDE 2

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Stack sorting Pop stack sorting 1-pop-stack sortability 2-pop-stack sortability Polyominoes on a helix Width 2 Width 3 Wrapping up

slide-3
SLIDE 3

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Permutations

Definitions

◮ permutation – an ordering of the members of a set ◮ Sn – the set of all permutations of {1, 2, . . . , n}.

Example: S3 = {123, 132, 213, 231, 312, 321}. π = 15243

slide-4
SLIDE 4

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Permutations

Definitions

◮ permutation – an ordering of the members of a set ◮ Sn – the set of all permutations of {1, 2, . . . , n}.

Example: S3 = {123, 132, 213, 231, 312, 321}. π = 15243 π = 15243 contains 132.

slide-5
SLIDE 5

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Permutations

Definitions

◮ permutation – an ordering of the members of a set ◮ Sn – the set of all permutations of {1, 2, . . . , n}.

Example: S3 = {123, 132, 213, 231, 312, 321}. π = 15243 π = 15243 contains 132, but avoids 231.

slide-6
SLIDE 6

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Stacks

Stack Operations A stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove the top element from the stack and put it

  • n the end of the output.

Input: 15243 Output: S(15243) = . . .

slide-7
SLIDE 7

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Stacks

Stack Operations A stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove the top element from the stack and put it

  • n the end of the output.

Input: 5243

1

Output: S(15243) = . . .

slide-8
SLIDE 8

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Stacks

Stack Operations A stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove the top element from the stack and put it

  • n the end of the output.

Input: 5243 Output: S(15243) = 1 . . .

slide-9
SLIDE 9

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Stacks

Stack Operations A stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove the top element from the stack and put it

  • n the end of the output.

Input: 243

5

Output: S(15243) = 1 . . .

slide-10
SLIDE 10

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Stacks

Stack Operations A stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove the top element from the stack and put it

  • n the end of the output.

Input: 43

2 5

Output: S(15243) = 1 . . .

slide-11
SLIDE 11

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Stacks

Stack Operations A stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove the top element from the stack and put it

  • n the end of the output.

Input: 43

5

Output: S(15243) = 12 . . .

slide-12
SLIDE 12

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Stacks

Stack Operations A stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove the top element from the stack and put it

  • n the end of the output.

Input: 3

4 5

Output: S(15243) = 12 . . .

slide-13
SLIDE 13

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Stacks

Stack Operations A stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove the top element from the stack and put it

  • n the end of the output.

Input:

3 4 5

Output: S(15243) = 12 . . .

slide-14
SLIDE 14

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Stacks

Stack Operations A stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove the top element from the stack and put it

  • n the end of the output.

Input: Output: S(15243) = 12345 15243 is 1-stack sortable.

slide-15
SLIDE 15

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Stacks

Stack Operations A stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove the top element from the stack and put it

  • n the end of the output.

Input: 35142 Output: S(35142) = . . .

slide-16
SLIDE 16

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Stacks

Stack Operations A stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove the top element from the stack and put it

  • n the end of the output.

Input: 5142

3

Output: S(35142) = . . .

slide-17
SLIDE 17

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Stacks

Stack Operations A stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove the top element from the stack and put it

  • n the end of the output.

Input: 5142 Output: S(35142) = 3 . . . 35142 is not 1-stack sortable.

slide-18
SLIDE 18

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Stacks

Stack Operations A stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove the top element from the stack and put it

  • n the end of the output.

Input: 142

5

Output: S(35142) = 3 . . . 35142 is not 1-stack sortable.

slide-19
SLIDE 19

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Stacks

Stack Operations A stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove the top element from the stack and put it

  • n the end of the output.

Input: 42

1 5

Output: S(35142) = 3 . . . 35142 is not 1-stack sortable.

slide-20
SLIDE 20

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Stacks

Stack Operations A stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove the top element from the stack and put it

  • n the end of the output.

Input: 42

5

Output: S(35142) = 31 . . . 35142 is not 1-stack sortable.

slide-21
SLIDE 21

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Stacks

Stack Operations A stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove the top element from the stack and put it

  • n the end of the output.

Input: 2

4 5

Output: S(35142) = 31 . . . 35142 is not 1-stack sortable.

slide-22
SLIDE 22

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Stacks

Stack Operations A stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove the top element from the stack and put it

  • n the end of the output.

Input:

2 4 5

Output: S(35142) = 31 . . . 35142 is not 1-stack sortable.

slide-23
SLIDE 23

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Stacks

Stack Operations A stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove the top element from the stack and put it

  • n the end of the output.

Input: Output: S(35142) = 31245 35142 is not 1-stack sortable. But S(S(35142)) = S(31245) = 12345, so 35142 is 2-stack sortable.

slide-24
SLIDE 24

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Stacks

Stack Operations A stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove the top element from the stack and put it

  • n the end of the output.

In general, if πi = n, write L = π1 · · · πi−1 and R = πi+1 · · · πn so that π = LnR. S(LnR) = S(L)S(R)n.

slide-25
SLIDE 25

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Stack sortable permutations

Theorem (Knuth, 1973) π ∈ Sn is 1-stack sortable iff π avoids 231. There are Cn =

2n

n

  • n + 1 such permutations.
slide-26
SLIDE 26

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Stack sortable permutations

Theorem (Knuth, 1973) π ∈ Sn is 1-stack sortable iff π avoids 231. There are Cn =

2n

n

  • n + 1 such permutations.

Theorem (West, 1990) π ∈ Sn is 2-stack sortable iff π avoids 2341 and 35241. S(S(2341)) = S(2314) = 2134 S(S(3241)) = S(2314) = 2134 S(S(35241)) = S(32145) = 12345

slide-27
SLIDE 27

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Stack sortable permutations

Theorem (Knuth, 1973) π ∈ Sn is 1-stack sortable iff π avoids 231. There are Cn =

2n

n

  • n + 1 such permutations.

Theorem (West, 1990) π ∈ Sn is 2-stack sortable iff π avoids 2341 and 35241. Theorem (Zeilberger, 1992) There are 2(3n)! (n + 1)!(2n + 1)! 2-stack sortable permutations

  • f length n.
slide-28
SLIDE 28

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Pop stacks

Pop Stack Operations A pop stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove all elements from the stack and put them

  • n the end of the output.

Input: 15243 Output: P(15243) = . . .

slide-29
SLIDE 29

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Pop stacks

Pop Stack Operations A pop stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove all elements from the stack and put them

  • n the end of the output.

Input: 5243

1

Output: P(15243) = . . .

slide-30
SLIDE 30

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Pop stacks

Pop Stack Operations A pop stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove all elements from the stack and put them

  • n the end of the output.

Input: 5243 Output: P(15243) = 1 . . .

slide-31
SLIDE 31

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Pop stacks

Pop Stack Operations A pop stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove all elements from the stack and put them

  • n the end of the output.

Input: 243

5

Output: P(15243) = 1 . . .

slide-32
SLIDE 32

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Pop stacks

Pop Stack Operations A pop stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove all elements from the stack and put them

  • n the end of the output.

Input: 43

2 5

Output: P(15243) = 1 . . .

slide-33
SLIDE 33

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Pop stacks

Pop Stack Operations A pop stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove all elements from the stack and put them

  • n the end of the output.

Input: 43 Output: P(15243) = 125 . . . 15243 is not 1-pop-stack sortable.

slide-34
SLIDE 34

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Pop stacks

Pop Stack Operations A pop stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove all elements from the stack and put them

  • n the end of the output.

Input: 3

4

Output: P(15243) = 125 . . . 15243 is not 1-pop-stack sortable.

slide-35
SLIDE 35

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Pop stacks

Pop Stack Operations A pop stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove all elements from the stack and put them

  • n the end of the output.

Input:

3 4

Output: P(15243) = 125 . . . 15243 is not 1-pop-stack sortable.

slide-36
SLIDE 36

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Pop stacks

Pop Stack Operations A pop stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove all elements from the stack and put them

  • n the end of the output.

Input: Output: P(15243) = 12534 15243 is not 1-pop-stack sortable.

slide-37
SLIDE 37

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Pop stacks

Pop Stack Operations A pop stack is a last-in first-out data-structure with two

  • perations:

◮ push – remove the first element from input and put it

  • n the top of the stack

◮ pop – remove all elements from the stack and put them

  • n the end of the output.

In general, if π1 · · · πi is the longest decreasing prefix of π, write R = πi+1 · · · πn so that π = π1 · · · πiR. P(π1 · · · πiR) = πi · · · π1P(R).

slide-38
SLIDE 38

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Pop-stack sortable permutations

If P(π) = 12 · · · n, then π is layered. Theorem (Avis and Newborn, 1981) π ∈ Sn is 1-pop-stack sortable iff π avoids 231 and 312. There are 2n−1 such permutations.

slide-39
SLIDE 39

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Compositions

Definition Composition of n – an ordered arrangement of positive integers whose sum is n Example: n = 3 3 2+1 1+2 1+1+1

slide-40
SLIDE 40

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Compositions

Definition Composition of n – an ordered arrangement of positive integers whose sum is n Example: n = 3 3 2+1 1+2 1+1+1

  • π∈1PSS

x|π|yasc(π) =

  • n=1

n−1

  • k=0
  • n − 1

k

  • xnyk =

x 1 − x − xy

slide-41
SLIDE 41

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

2-Pop-stack sortability

Definition A block of a permutation is a maximal contiguous decreasing subsequence. Example: π = 15243 has blocks B1 = 1, B2 = 52, B3 = 43

slide-42
SLIDE 42

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

2-Pop-stack sortability

Definition A block of a permutation is a maximal contiguous decreasing subsequence. Example: π = 15243 has blocks B1 = 1, B2 = 52, B3 = 43 Claim π with blocks B1, . . . , Bℓ is 2-pop-stack sortable iff either max(Bi) < min(Bi+1) or max(Bi) = min(Bi+1) + 1 for 1 ≤ i ≤ ℓ − 1. Notice: P(P(15243)) = P(12534) = 12354.

slide-43
SLIDE 43

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

2-Pop-stack sortability

Claim π with blocks B1, . . . , Bℓ is 2-pop-stack sortable iff either max(Bi) < min(Bi+1) or max(Bi) = min(Bi+1) + 1 for 1 ≤ i ≤ ℓ − 1.

slide-44
SLIDE 44

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

2-Pop-stack sortability

Claim π with blocks B1, . . . , Bℓ is 2-pop-stack sortable iff either max(Bi) < min(Bi+1) or max(Bi) = min(Bi+1) + 1 for 1 ≤ i ≤ ℓ − 1.

slide-45
SLIDE 45

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

2-Pop-stack sortability

Claim π with blocks B1, . . . , Bℓ is 2-pop-stack sortable iff either max(Bi) < min(Bi+1) or max(Bi) = min(Bi+1) + 1 for 1 ≤ i ≤ ℓ − 1. π avoids 4231.

slide-46
SLIDE 46

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

2-Pop-stack sortability

Claim π with blocks B1, . . . , Bℓ is 2-pop-stack sortable iff either max(Bi) < min(Bi+1) or max(Bi) = min(Bi+1) + 1 for 1 ≤ i ≤ ℓ − 1. π avoids 4231, 2341, 3412

slide-47
SLIDE 47

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

2-Pop-stack sortability

Claim π with blocks B1, . . . , Bℓ is 2-pop-stack sortable iff either max(Bi) < min(Bi+1) or max(Bi) = min(Bi+1) + 1 for 1 ≤ i ≤ ℓ − 1. π avoids 4231, 2341, 3412, 3241, 4312

slide-48
SLIDE 48

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

2-Pop-stack sortability

Claim π with blocks B1, . . . , Bℓ is 2-pop-stack sortable iff either max(Bi) < min(Bi+1) or max(Bi) = min(Bi+1) + 1 for 1 ≤ i ≤ ℓ − 1. π avoids 4231, 2341, 3412, 3241, 4312, 3421, 4132

slide-49
SLIDE 49

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

2-Pop-stack sortability

Claim π with blocks B1, . . . , Bℓ is 2-pop-stack sortable iff either max(Bi) < min(Bi+1) or max(Bi) = min(Bi+1) + 1 for 1 ≤ i ≤ ℓ − 1. π avoids 4231, 2341, 3412, 3241, 4312, 3421, 4132, 4123

slide-50
SLIDE 50

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

2-Pop-stack sortability

Claim π with blocks B1, . . . , Bℓ is 2-pop-stack sortable iff either max(Bi) < min(Bi+1) or max(Bi) = min(Bi+1) + 1 for 1 ≤ i ≤ ℓ − 1. π avoids 4231, 2341, 3412, 3241, 4312, 3421, 4132, 4123

slide-51
SLIDE 51

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

2-Pop-stack sortability

Claim π with blocks B1, . . . , Bℓ is 2-pop-stack sortable iff either max(Bi) < min(Bi+1) or max(Bi) = min(Bi+1) + 1 for 1 ≤ i ≤ ℓ − 1. π avoids 4231, 2341, 3412, 3241, 4312, 3421, 4132, 4123, 41352, 41352

slide-52
SLIDE 52

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

2-Pop-stack sortability

Claim π with blocks B1, . . . , Bℓ is 2-pop-stack sortable iff either max(Bi) < min(Bi+1) or max(Bi) = min(Bi+1) + 1 for 1 ≤ i ≤ ℓ − 1. Theorem (P and Smith, 2017+) π is 2-pop-stack sortable iff π avoids 2341, 3412, 3421, 4123, 4231, 4312, 41352, and 41352.

slide-53
SLIDE 53

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

2-Pop-stack sortability

Claim π with blocks B1, . . . , Bℓ is 2-pop-stack sortable iff either max(Bi) < min(Bi+1) or max(Bi) = min(Bi+1) + 1 for 1 ≤ i ≤ ℓ − 1.

◮ Given a composition c, let f (c) be the number of pairs

  • f adjacent summands that aren’t both 1.

Example: f (1 + 2 + 1 + 1) = 2.

slide-54
SLIDE 54

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

2-Pop-stack sortability

Claim π with blocks B1, . . . , Bℓ is 2-pop-stack sortable iff either max(Bi) < min(Bi+1) or max(Bi) = min(Bi+1) + 1 for 1 ≤ i ≤ ℓ − 1.

◮ Given a composition c, let f (c) be the number of pairs

  • f adjacent summands that aren’t both 1.

Example: f (1 + 2 + 1 + 1) = 2.

◮ There are 2f (c) 2-pop-stack sortable permutations with

block structure given by c. Example: The 2-pop-stack sortable permutations with block structure 1 + 2 + 1 + 1 are:

slide-55
SLIDE 55

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Enumeration via ascents

Notation

◮ a(n, k) is the number of 2-pop-stack sortable

permutations of length n with k ascents.

◮ b(n, k) is the number permutations counted by a(n, k)

with last block of size 1.

a(n, k) =            k < 0 or k ≥ n 1 k = 0 or k = n − 1 2

n−1

  • i=1

a(i, k − 1) − b(n − 1, k − 1)

  • therwise

b(n, k) =      k < 1 or k ≥ n 1 k = n − 1 2a(n − 1, k − 1) − b(n − 1, k − 1)

  • therwise
slide-56
SLIDE 56

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Enumeration via ascents

Theorem (P and Smith, 2017+)

  • π∈2PSS

x |π|y asc(π) =

  • n=1

n−1

  • k=0

a(n, k)x ny k = x(x 2y + 1) 1 − x − xy − x 2y − 2x 3y 2

slide-57
SLIDE 57

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Enumeration via ascents

Theorem (P and Smith, 2017+)

  • π∈2PSS

x |π|y asc(π) =

  • n=1

n−1

  • k=0

a(n, k)x ny k = x(x 2y + 1) 1 − x − xy − x 2y − 2x 3y 2

Corollary

  • π∈2PSS

x |π| = x(x 2 + 1) 1 − 2x − x 2 − 2x 3

OEIS A224232: 1, 2, 6, 16, 42, 112, 298, 792, . . . So |2PSSn| = 2 |2PSSn−1| + |2PSSn−2| + 2 |2PSSn−3|.

slide-58
SLIDE 58

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Polyominoes

n = 1: n = 2: n = 3: OEIS A001168: 1, 2, 6, 19, 63, 216, 760, . . . (General formula is open)

slide-59
SLIDE 59

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Polyominoes on a helix

1 2 2 3 4 4 5 6

width 2 helix

1 2 3 3 4 5 6 6 7 8 9

width 3 helix

slide-60
SLIDE 60

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Polyominoes on a helix of width 2

1 2 2 3 4 4 5 6

n = 1: n = 2: n = 3:

( are all the same polyomino now!)

Sequence: 1, 2, 4, . . . , 2n−1, . . .

slide-61
SLIDE 61

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Polyominoes on a helix of width 2

The following are equinumerous:

◮ compositions of n ◮ 1-pop-stack sortable permutations of length n ◮ {a, d}n−1 ◮ polyominoes of size n on a helix of width 2

3 dd 2+1 da 1+2 ad 1+1+1 aa

slide-62
SLIDE 62

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Polyominoes on a helix of width 3

1 2 3 3 4 5 6 6 7 8 9

n = 1: n = 2: n = 3: Sequence: 1, 2, 6, 16, 42, 112, . . . (OEIS A224232, same as 2-pop-stack sortable permutations)

slide-63
SLIDE 63

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Rebuilding 2-pop-stack sortable permutations

◮ last block has size 1

◮ π = ˆ

π|n

◮ π = ˆ

π|n¯ π|(n − 1) where ¯ π is the longest decreasing suffix of ˆ π¯ π

◮ π = ˆ

π|(a + 1)|(n)(a)|(n − 1) where a < n − 2

◮ last block has size at least 2

◮ π = ˆ

π|n¯ π where ¯ π is the longest decreasing suffix of ˆ π¯ π

◮ π = ˆ

π|(n − 1)|(n)(n − 2)

◮ π = ˆ

π|(n − 2)|(n)(n − 3)

slide-64
SLIDE 64

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Rebuilding 2-pop-stack sortable permutations

◮ last block has size 1

◮ π = ˆ

π|n ˆ π ∈ 2PSSn−1

◮ π = ˆ

π|n¯ π|(n − 1) where ¯ π is the longest decreasing suffix of ˆ π¯ π ˆ π¯ π ∈ 2PSSn−2

◮ π = ˆ

π|(a + 1)|(n)(a)|(n − 1) where a < n − 2 ˆ π(a + 1) ∈ 2PSSn−3, ends in ascent

◮ last block has size at least 2

◮ π = ˆ

π|n¯ π where ¯ π is the longest decreasing suffix of ˆ π¯ π ˆ π¯ π ∈ 2PSSn−1

◮ π = ˆ

π|(n − 1)|(n)(n − 2) ˆ π ∈ 2PSSn−3

◮ π = ˆ

π|(n − 2)|(n)(n − 3) ˆ π ∈ 2PSSn−3, ends in descent

|2PSSn| = 2 · |2PSSn−1| + |2PSSn−2| + 2 · |2PSSn−3|

slide-65
SLIDE 65

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Permutations to polyominoes

Matching with recursive width 3 polyomino cases

  • f Aleksandrowicz, et. al., 2013

◮ last block has size 1

◮ π = ˆ

π|✁ ❆ n

◮ π = ˆ

π|✁ ❆ n¯ π|✘✘✘ ✘ ❳❳❳ ❳ (n − 1)

◮ π = ˆ

π|(a + 1)|✚ ✚ ❩ ❩ (n)✚ ✚ ❩ ❩ (a)|✘✘✘ ✘ ❳❳❳ ❳ (n − 1)

◮ last block has size at least 2

◮ π = ˆ

π|✁ ❆ n¯ π

  • r

◮ π = ˆ

π|✘✘✘ ✘ ❳❳❳ ❳ (n − 1)|✚ ✚ ❩ ❩ (n)✘✘✘ ✘ ❳❳❳ ❳ (n − 2)

◮ π = ˆ

π|✘✘✘ ✘ ❳❳❳ ❳ (n − 2)|✚ ✚ ❩ ❩ (n)✘✘✘ ✘ ❳❳❳ ❳ (n − 3)

slide-66
SLIDE 66

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Summary

◮ π is 2-pop-stack sortable iff π avoids 2341, 3412, 3421,

4123, 4231, 4312, 41352, and 41352.

  • π∈2PSS

x|π| = x(x2 + 1) 1 − 2x − x2 − 2x3

◮ Bijections!

◮ 1-pop-stack sortable permutations are in bijection with

polyominoes on a helix of width 2

◮ 2-pop-stack sortable permutations are in bijection with

polyominoes on a helix of width 3

slide-67
SLIDE 67

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

Summary

◮ π is 2-pop-stack sortable iff π avoids 2341, 3412, 3421,

4123, 4231, 4312, 41352, and 41352.

  • π∈2PSS

x|π| = x(x2 + 1) 1 − 2x − x2 − 2x3

◮ Bijections!

◮ 1-pop-stack sortable permutations are in bijection with

polyominoes on a helix of width 2

◮ 2-pop-stack sortable permutations are in bijection with

polyominoes on a helix of width 3

◮ ...but 3-pop-stack sortable permutations aren’t in

bijection with polyominoes on a helix of width 4.

slide-68
SLIDE 68

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

References

◮ G. Aleksandrowich, A. Asinowski, and G. Barequet, Permutations

with forbidden patterns and polyominoes on a twisted cylinder of width 3. Discrete Math. 313 (2013), 1078–1086.

◮ D. Avis and M. Newborn, On pop-stacks in series. Utilitas Math.

19 (1981), 129–140.

◮ D. E. Knuth, The art of computer programming. Volume 3.

Addison-Wesley Publishing Co., Reading, Mass.-London-Don Mills, Ont., 1973. Sorting and searching, Addison-Wesley Series in Computer Science and Information Processing.

◮ J. West, Permutations with forbidden subsequences and stack

sortable permutations. Ph.D. thesis, MIT, 1990.

◮ D. Zeilberger, A proof of Julian West’s conjecture that the

number of two-stack sortable permutations of length n is 2(3n)!/((n + 1)!(2n + 1)!). Disc. Math. 102 (1992), 85–93.

slide-69
SLIDE 69

Sorting with Pop Stacks Lara Pudwell Stack sorting Pop stack sorting

1-pop-stack sortability 2-pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

References

◮ G. Aleksandrowich, A. Asinowski, and G. Barequet, Permutations

with forbidden patterns and polyominoes on a twisted cylinder of width 3. Discrete Math. 313 (2013), 1078–1086.

◮ D. Avis and M. Newborn, On pop-stacks in series. Utilitas Math.

19 (1981), 129–140.

◮ D. E. Knuth, The art of computer programming. Volume 3.

Addison-Wesley Publishing Co., Reading, Mass.-London-Don Mills, Ont., 1973. Sorting and searching, Addison-Wesley Series in Computer Science and Information Processing.

◮ J. West, Permutations with forbidden subsequences and stack

sortable permutations. Ph.D. thesis, MIT, 1990.

◮ D. Zeilberger, A proof of Julian West’s conjecture that the

number of two-stack sortable permutations of length n is 2(3n)!/((n + 1)!(2n + 1)!). Disc. Math. 102 (1992), 85–93.

Thanks for listening!

slides at faculty.valpo.edu/lpudwell email: Lara.Pudwell@valpo.edu