Amir.K's blog

By Amir.K, 9 years ago, In English

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 !!!

  • Vote: I like it
  • -2
  • Vote: I do not like it

»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

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