Блог пользователя Amir.K

Автор Amir.K, 9 лет назад, По-английски

HI Everyone...

I came across this problem on UVa Safe Salutations I know that it can be solved with the Catalan Numbers but I wanna know WHY ???!! In other words I wanna know the proof that Catalan Numbers work on this problem... THANKS !!!

  • Проголосовать: нравится
  • -2
  • Проголосовать: не нравится

»
9 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Let all vertices be numbered from 1 to n at clockwise order starting from some vertice. Let's make such sequence b of n elements: if i-th vertice is connected with j and i < j, then b[i] = '(', else b[i] = ')'. Easy to understand, that if graph was correct, than b — is correct bracket sequence, and if graph wasn't correct than b is not correct bracket sequence. So, problem is equivalent to counting number of correct bracket sequences of length 2n and well-known that answer is n-th Catalan number.

  • »
    »
    9 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Thank You! It seems kind of obvious now... But I still need the "Mathematical" proof !! Like why if I had n pairs of points and I wanna connect them in pairs without making intersection between the lines that connects them I can make this with Cat(n) of ways ??

    • »
      »
      »
      9 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Because this problem is equivalent to the problem of counting number of correct bracket sequences, so answer is same.