Algorithms, solution methods, comparison of their performance - page 10

 
Sergey Dzyublik:

Each time you add data, it overwrites all the old data into a new string.

There is, however, an option to set an "array reserve" via this.

Документация по MQL5: Строковые функции / StringInit
Документация по MQL5: Строковые функции / StringInit
  • www.mql5.com
[in]  Длина строки после инициализации. Если размер=0, то деинициализирует строку, то есть, буфер строки освобождается и адрес буфера обнуляется. Если  character=0 и размер new_len>0, то...
 
fxsaber:

There is, however, the option of setting an 'array reserve' through this.

Thank you. That's a good idea.
 
Sergey Dzyublik:

Jeez, the author really doesn't understand that every time he adds data he overwrites all the old ones into a new string.
We can't speak of any saving except mockery.

Can you explain clearly and precisely what you mean?

Is it really that difficult?

Is there something wrong with this record? If you add characters to the string, something awful (mocking) happens?

 //---------------------------------
 //Записываем каждый магик вместе с порядковым номером ордера.
 //---------------------------------
 All_magics +=  "_" + (string)order_number + "_" + (string)magic;
 //---------------------------------
 
Реter Konow:

Can you explain clearly and precisely what you mean?

You are inventing a DBMS through X place. Spend 2-3 months on FoxPro/dBase with some DBMS theory(lectures).

 
Petr Doroshenko:

You are inventing a DBMS through X place. Spend 2-3 months on FoxPro/dBase with some DBMS theory(s).


What kind of DBMS, what are you saying to someone who understands zero about data structures.
If there is no concept of ArrayList (vector from C++), what can we talk about here.....

 
Реter Konow:

Can you explain clearly and precisely what you mean?

How hard can it be?

Is there something wrong with this entry? If you add characters to a string, does something horrible (mocking) happen?


1. Your code is not working.
The "_index_magic" pattern is wrong. Possible solution is "|index_magic".

After adding it, we have _1_3_2_4_3_5_4_6_.
Please find the 3rd in the list.
You will get the result 2.



2. Your algorithm has speed O(n) with three passes of string valueAll_magics
If you search for the last added item, it will take time directly proportional to the number of items - O(n).
Also, it takes a lot of time to copy it into a new string.

3. Your performance measurement is absolutely incorrect:

- no average result in the series
- no series with search for the last index values

 
Sergey Dzyublik:

What kind of DBMS, what you say to a man who knows NOTHING about data structures.
If there is no concept of ArrayList (a vector from C++), what can we talk about here.....

Can you talk without being superior in your words and thoughts? So Peter is wrong, so he stumbles... But that's out of ignorance. Why are you making a fuss now?

You do not want to give him an example - just an example - so, please, dispense with caustic remarks. Peter can do you in some other field of activity. Let's make fun of you on a topic where he can?

Don't give me that childish attitude, please.

 
Sergey Dzyublik:

1. Your code is not working.
Incorrect pattern "_index_magic". A possible solution is "|index_magic".


After adding it, we have _1_3_2_4_3_5_4_6_.
Please find the 3rd in the list.
You will get the result 2.



2. Your algorithm has speed O(n) with three passes of string valueAll_magics
If you search for the last added item, it will take time directly proportional to the number of items - O(n).
Also, it takes a lot of time to copy it into a new string.

3. Your performance measurement is completely incorrect:

- no average result in the series
- no series with lookup of last index values

1. I don't know what pattern you're talking about. Honestly. The code is just an example of writing medgies to and extracting them from a string. It demonstrates usability and speed. Perhaps there are problems with memory consumption. Otherwise, I don't know what else could be wrong with it. I practically don't understand it. I also don't understand it:

После добавления имеем  _1_3_2_4_3_5_4_6_
Найдите пожалуйста 3-й в списке.
Вы получите результат 2.

What is it?

//---------------------------------

2. We go through the string three times in order to find the start and end of a medjic substring and extract it from the overall string.

So far, practice has not shown any of the difficulties you listed.

//---------------------------------

3. Special and very accurate measurements, I did not, BUT - my speed measurements showed that the search for a particular element is carried out for 10 - 100 microseconds, depending on the serial number of the transaction. That is, from the location in the row. Even if it takes 1000 microseconds to search - it's still very fast.

You don't need to retrieve all elements at once. But even if you do, it will take a couple of tens of milliseconds (do the math).

 
Реter Konow:

1. I don't know what pattern we're talking about. Honestly. The code is just an example of writing medgies to and extracting them from a string. It demonstrates convenience and speed. Perhaps there are problems with memory consumption. Otherwise, I don't know what else could be wrong with it. I practically don't understand it. I also don't understand it:

There is a very strong need to read a tutorial on C#. It's all clearly spelled out how strings work. The link is simple - MSDN.
And this whole ridiculous subject is just because of man's aversion to OOP and desire to know what it is.
God, send a blacklist to this forum already!

p.s: where in the thread are the algorithms and their discussion?

 
Alexey Oreshkin:

...

p.s.: where are the algorithms and their discussion in the thread?

So far all I see here is a mockery of the person who had the audacity to post his solution here.

It's clear that it's... to put it mildly, it's a total waste of time. But he posted it. The rest have the courage to laugh and point fingers.

Reason: