wannared's blog

By wannared, history, 7 years ago, In English

How to solve the last problem? Link

  • Vote: I like it
  • +7
  • Vote: I do not like it

| Write comment?
»
7 years ago, # |
  Vote: I like it +29 Vote: I do not like it

Find number of distinct subtrees (non isomorphic rooted) of second tree. Find number of distinct leaves in first subtree. The answer is product of both of them.

Note: distinct leaves means that one cannot act as substitute for another(Bad explanation).

To find distinct subtrees or distinct leaves ,use hashing (strong one ,easy ones are hacked)

There are some details left to work on your own. refer to the code for help.
My code for reference: Here

  • »
    »
    7 years ago, # ^ |
      Vote: I like it +7 Vote: I do not like it

    How to solve second last problem?
    (equal one)

»
7 years ago, # |
  Vote: I like it +14 Vote: I do not like it

problem statement not visible bro!