The answer should be a vector because it uses an array to store the
elements internally and
since an array consists of contiguous memory locations, sequential access
will be the fastest.
In contrast to SLL or a DLL, the nodes may be at random memory locations
and will not provide
the fastest
@Ansum: Notice that the problem does not ask to give a method of making as
many numbers as possible equal, but only what the maximum number is. Here
is an algorithm for achieving an array with the equality numbers I
specified:
1. If the sum of the numbers is a multiple of n, then avg = sum/n
This can be done using 0/1 knapsack solution.
sum up all the numbers in an array.
try to solve 0/1 knapsack where size of the knapsack is sum/2 and value is
1.we get 2 sets(say P(knapsack set),Q).
if the knapsack is perfectly filled, that is the answer.
If not, take the remaining unfilled part of
Hi All,
Please suggest any one, group or forums related to Operating System
and Network like algogeeks.
Thanks
Vivek P
--