Need help with the poblem- HELP on spoj

Правка en1, от 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.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский bhattacharjee 2017-01-08 01:06:55 400 Initial revision (published)