Sorting with Pop Stacks Stacks Pop stacks 1-Pop-stack sortability - - PowerPoint PPT Presentation

sorting with pop stacks
SMART_READER_LITE
LIVE PREVIEW

Sorting with Pop Stacks Stacks Pop stacks 1-Pop-stack sortability - - PowerPoint PPT Presentation

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


slide-1
SLIDE 1

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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)

15th International Conference on Permutation Patterns

Reykjavik University June 29, 2017

slide-2
SLIDE 2

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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-3
SLIDE 3

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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-4
SLIDE 4

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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: 21534 Output: P(21534) = . . .

slide-5
SLIDE 5

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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: 1534

2

Output: P(21534) = . . .

slide-6
SLIDE 6

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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: 534

1 2

Output: P(21534) = . . .

slide-7
SLIDE 7

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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: 534 Output: P(21534) = 12 . . .

slide-8
SLIDE 8

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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: 34

5

Output: P(21534) = 12 . . .

slide-9
SLIDE 9

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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: 4

3 5

Output: P(21534) = 12 . . .

slide-10
SLIDE 10

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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: 4 Output: P(21534) = 1235 . . . 21534 is not 1-pop-stack sortable.

slide-11
SLIDE 11

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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:

4

Output: P(21534) = 1235 . . . 21534 is not 1-pop-stack sortable.

slide-12
SLIDE 12

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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(21534) = 12354 21534 is not 1-pop-stack sortable.

slide-13
SLIDE 13

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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-14
SLIDE 14

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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-15
SLIDE 15

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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-16
SLIDE 16

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

1-Pop-stack sortability 2-Pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

2-Pop-stack sortability

Definition A permutation π ∈ Sn is 2-pop-stack sortable if and only if P(P(π)) = 1 · · · n. Notation If P(P(π)) = 1 · · · n, write π ∈ P2,n. Let P2 =

n≥1 P2,n.

Example: 21534 ∈ P2,5 because P(P(21534)) = P(12354) = 12345.

slide-17
SLIDE 17

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

1-Pop-stack sortability 2-Pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

2-Pop-stack sortability

Definition A permutation π ∈ Sn is 2-pop-stack sortable if and only if P(P(π)) = 1 · · · n. Notation If P(P(π)) = 1 · · · n, write π ∈ P2,n. Let P2 =

n≥1 P2,n.

Example: 21534 ∈ P2,5 because P(P(21534)) = P(12354) = 12345. Definition A block of a permutation is a maximal contiguous decreasing subsequence. Example: π = 21534 has blocks B1 = 21, B2 = 53, B3 = 4.

slide-18
SLIDE 18

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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. π P(π)

B1 B2 B3 B1 B2 B3

slide-19
SLIDE 19

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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. π P(π)

B1 B2 B3 B1 B2 B3

Theorem (P and Smith, 2017+) π is 2-pop-stack sortable iff π avoids 2341, 3412, 3421, 4123, 4231, 4312, 41352, and 41352.

slide-20
SLIDE 20

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

1-Pop-stack sortability 2-Pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

2-Pop-stack sortability

Lemma π 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-21
SLIDE 21

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

1-Pop-stack sortability 2-Pop-stack sortability

Polyominoes on a helix

Width 2 Width 3

Wrapping up

2-Pop-stack sortability

Lemma π 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-22
SLIDE 22

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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 of 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-23
SLIDE 23

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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+)

  • π∈P2

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

x(x2y + 1) 1 − x − xy − x2y − 2x3y2 =x + (y + 1)x2 + (y2 + 4y + 1)x3 + (y3 + 8y2 + 6y + 1)x4 + (y4 + 12y3 + 20y2 + 8y + 1)x5 + (y5 + 16y4 + 48y3 + 36y2 + 10y + 1)x6 + · · ·

slide-24
SLIDE 24

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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+)

  • π∈P2

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

  • π∈P2

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

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

slide-25
SLIDE 25

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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-26
SLIDE 26

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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-27
SLIDE 27

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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-28
SLIDE 28

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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

4 + 2 + 1 + 3

slide-29
SLIDE 29

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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-30
SLIDE 30

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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

5 ⊕ 1 ⊕ 1 ⊕ 3

slide-31
SLIDE 31

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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

5 ⊞ 1 ⊕ 2 ⊕ 3 ⊞ 3

slide-32
SLIDE 32

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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.

  • π∈P2

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-33
SLIDE 33

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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.

  • π∈P2

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-34
SLIDE 34

Sorting with Pop Stacks Lara Pudwell Stacks Pop stacks

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.

Thanks for listening!

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