bhattacharjee's blog

By bhattacharjee, history, 8 years ago, In English

How can I approach this problem using optimal binary search tree?

Here is what I've been trying so far: 1) finding heights of each node 2) using those heights as frequencies and creating a OBST 3) printing the depth of each node on that OBST as result.

This is giving me WA. I can't find any other way. So I'd really appreciate any help.

Thank you.

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