edited by
414 views
0 votes
0 votes
Let $F_1,F_2,..............F_n$ be files with length $L_1,L_2........L_n$ we would like to merge all of the files together to make a single file .The cost of merging files is $m+n$ if the files have length  $m$ and $n$ .Find the minimum cost of merging ten files whose length are $5,3,10,20,15,10,5,1,2,4$ is _____________.
edited by

1 Answer

Best answer
1 votes
1 votes

Check this in this just merge 2 files with least cost always so we start with files whose cost is 3 (1,2 ) by this we move forward by merging least cost files then we add all the internal nodes to have the cost of merging the files 

https://xlinux.nist.gov/dads//HTML/optimalMerge.html

selected by