- Where Developers Learn, Share, & Build Careers


I need an algorithm which can fill an array (size n) from the same value, in log (n) time, in parallel. This means that for naive solution (i = 0; i & lt; = n-1; i ++) will be t [i] = 10 is not enough Because it takes o (n) time, I need something that can O (log (n)) take . It is very important that I mentioned that it has to be done in PARALLEL. I was thinking about a dependency, but I can not figure it out.

There are several ways to confuse yourself as a simple loop

 for  (i = 0; i & lt; = (SIZE / 2); i ++) {arr [i] = 10; Arrival [Size- (i +1)] = 10; }   

which you consider to be O (N / 2) but in fact you have to type the value in the code n bar, whatever you take, you will eventually The assignment operation will execute n times.

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -