Clearing an array of defined element(s) - page 19

 

In short, the final array may be a mess, but the checksum will confirm that the algorithm works correctly. After all, if there are zeros in the cells, this will not change the checksum. The array may be set to the wrong size, there may be blanks inside, but the checksum will be the same.

This check is not good.

 
Реter Konow:

ArrayResize - The function can only be applied to dynamic arrays.

 
Aleksey Lebedev:

ArrayResize - The function can only be applied to dynamic arrays.

Need a troll face smiley face
 
Nikolai Semko:

Nikolai, put my function in the test and you will see that I came out on top when tested by the checksum.

int PeterArray(int &Arr[],int val) // вариант Peter Konow
  {
   int q = 0;
   for(int a1=0; a1<ArraySize(Arr); a1++)
     {
      if(Arr[a1]==val){Arr[a1] = 0;}
      q++;
     }
   return (q);
  }
2018.11.16 15:00:11.033 ArrayDeleteValue__6 (USDCAD,H1) вариант Peter:     Контрольная сумма = 496397962; элементов - 1000000; время выполнения = 1541 микросекунд
 
There's an elephant in the china shop )))
Shooooooo!
 
Aleksei Beliakov:
Need a troll face emoticon

They've already added it to browsers 💬

 
Nikolai Semko:
Here comes the elephant in the china shop )))
Shoo!

I don't know how to program. I don't know about ArrayPrint(). As a marketer I'm no good at all.

Only he who laughs last always laughs.

But in general, well done, everybody. The only thing that needs to be done is to check the algorithms...
 
Реter Konow:

Nikolai, put my function in the test and you will see that I came out on top if you test by checksum.

And let's go back to the problem at the beginning.

Vladimir Pastushak:

There is an array containing a set of data of type 1,2,3,6,9,5,6,3,25,6,8,7,4 you need to remove for example values of 3 and the output is the same array without 3 and empty spaces...

We get a completely unusable variant

 
Konstantin Nikitin:

And back to the task at hand at the beginning.

We've got a completely unsuitable option.

Right. (chuckles) But how do we know that the provided algorithms leave no empty spaces? The checksum doesn't prove it. Nor does the number of elements. Because the function counts the elements which were there before the array was resized.

 
Реter Konow:

I don't know how to program. I don't know about ArrayPrint(). As a marketer I'm no good at all.

Only he who laughs last is always the one who laughs last.

Anyway, good job, everyone. I just need some way to test the algorithms...
Sorry, Peter, couldn't resist. ))
In fact, I'd only be happy if you beat everyone, including me. Honestly.