sorry ..the complete question is
You are given a wooden log of length n. It has n+1 grooves marked on
it from 0 to n. You are given an array containing numbers within the
range of 1 to n-1. These elements of the array represents the points
on the log at which u need to cut the wooden log. Now the cost of
cutting a log is proportional to the length of the original log being
cut.
Eg: n=15 and A={1,5,9}
Now when u make a cut at 1, the cost is n (the size of original log)
When u cut at 9, the cost will be n-1 as the length of the new
original log is 1 to n i.e n-1
When u cut at 5, since 5 lies between 1 and 9 and the length of this
log is 9-1=8, so the cost will be 8.
The question is: given the value of 'n' and the Array A containing the
points at which u need to make a cut, find the order in which the cuts
must be made in order to minimize the total cost of cutting the wooden
log.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.