19
Developed and Presented by: OCdt Joseph Luc-André Sabourin

Generating All Catalan Sequences.pdf

Embed Size (px)

Citation preview

  • Developed and Presented by: OCdt Joseph Luc-Andr Sabourin

  • Describe an ordered sequence of 2 types of objects of equal number.

    At any given point in the sequence, the number of the first type is greater than or equal to the number of the second.

    =2 2 + 1

    =1

    + 12 0

  • Brackets

    (a)

    (a(a)a),(a)a(a)

    (a(a(a)a)a),(a(a)a(a)a),(a)a(a(a)a),(a)a(a)a(a),

    (a(a)a)a(a)

  • Binary Trees

  • Polygon Triangles

  • Dyck Paths

  • 1. Start with matrix notation: 1 3 2 3 2 12 4 2 2 2

    2. Switch from the bottom to the top and to the right:

  • 3. For multiple switches, start from the right and move left. Additional switches can only switch with values to the left of what has already been switched and to the right of itself (i.e. switch lines cant cross):

  • 4. Order each row in ascending order from left to right:

    5. Each column will increase down, and each row will increase to the right:

  • 1. Proving The Axioms

    2. Proving Uniqueness

    3. Proving All Catalan Sequences Are Generated

  • 1. Simple for to start from, however any Catalan Sequence can be used to start from.

    2. Moves a later primary object to an earlier position and an earlier secondary object to a later position.

    3. Prevents repetitions.

  • 4. Any secondary object that is switched will be to the right after ordering and any primary object will be to the left after ordering, respective to their original positions.

    5. Confirmation it is a Catalan Sequence.

  • Suppose p switches, but each set is different by one switch.

    After conducting the switches and orders, the element not switched in one will differ from the other.

    Therefore each combination of switches produces a different Catalan Sequence than any other one.

  • = 1 12 zero switches: 1

    = 2 1 32 4

    zero switches: 1, one switch: 1

    = 3 1 3 52 4 6

    zero switches: 1, one switch: 3,

    two switches: 1

    = 4 1 3 5 72 4 6 8

    zero switches: 1, one switch: 6,

    two switches: 6, three switches: 1

    = 5 1 3 5 7 92 4 6 8 10

    zero switches: 1, one switch: 10,

    two switches: 20, three switches: 10, four switches: 1

    Let , be the number of sequences produced, where n is the order and w is the number of switches.

  • n/w

    0

    1

    2

    3

    4

    5

    6 ,

    =

    1 1 1 1

    2 1 1 2 2

    3 1 3 1 5 5

    4 1 6 6 1 14 14

    5 1 10 20 10 1 42 42

    6 1 15 50 50 15 1 132 132

    7 1 21 105 175 105 21 1 429 429

  • Patterns:

    1. , = , +1

    2. = ,1=0

    Relationships:

    1. ,0 = 1

    2. ,1 = 1

    2

    3. ,2 = 1 2 2

    12

  • Suppose: , =1

    +1

    1 1 > 0

    Check Patterns:

    1. , =1

    +1

    1=1

    + 1

    1 ( + 1)

    = , +1

    2. ,1=0 =

    1

    +1

    1

    1=0 =

    + 1

    1 1 + 1

    1=0

    =2 1 1

    2 1 + 1

    =2

    + 12 1=1

    + 12=

    Therefore both patterns are satisfied, , =1

    +1

    1

    is true, and

    the switches produce all Catalan Sequences.

  • There are 3 recursive relationships (since there are two variables):

    1. , = 1, 1

    +1 2 > 0

    2. , = ,1 +1

    +1 2 > 1

    3. , = 1,1 1

    +1 2 > 1