Was trying to solve http://www.spoj.com/problems/FREQUENT/ and since was unable to figure out so finally looked at the solutions https://github.com/hbdhj/spoj-cpp/blob/master/1684_FREQUENT.cpp There I was unable to figure out what was being done in line 127 :- ""int temp = min(Tree[Node<<1].rfreq, m-u+1) + min(Tree[(Node<<1)+1].lfreq, v-m);"" kindly explain.. Though I know that here the mf was being calculated by using the leftnode.rf and rightnode.lf but what was the "m-u+1" & "v-m" was doing???
↧