The total number of ordered trees with three nodes

I get mixed answers online

I also saw the question in https://stackoverflow.com/a/3/312969/129 , but that didn't help me

What should be the answer?

  • Also is this a tree?

        a
       /
      b
     /
    c
    
+4
source share
2 answers

, , - , , "", . , ( ) .

-, , , , . , ( , ), , , , . , .

. , , , . node ( ) , .

. - A, B, C, ( ).

N, . T (N) , N () .

: N = 1. node, , node . , T (1) = 1.

: N = 2. node. node . , T (2) = 2.

: N = 3. node. node, :

  • A: node , . , . , 3 * 2 = 6 , , node .

  • B: node , . T (2) = 2 , 3 * 2 = 6 , , node .

( ), : T (3) = 6 + 6 = 12.

, , , , . , , :

: N. . N - 1 . , N - 1 ( N - 1 ). , . , , .

, . , , .

.. , , , -

    A                      A
   /                        \
  B           and            B
 /                            \
C                              C

, . , ( node , ). , . , , - . B. C. , .

+1

Source: https://habr.com/ru/post/1536766/


All Articles