Please read the new rule regarding the restriction on the use of AI tools. ×

Need help with the poblem- HELP on spoj

Revision en1, by bhattacharjee, 2017-01-08 01:06:55

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.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English bhattacharjee 2017-01-08 01:06:55 400 Initial revision (published)