Generic Class Library - bugs, description, questions, usage and suggestions - page 2

 
Combinator:
Average time O(1) worst O(n) and performance is strongly hash-dependent.

O(n) - that's if you do it head-on.

 
Vasiliy Sokolov:


As of December 6, 2017, the standard MetaTrader 5 delivery set includes the so-called Generic classes, which implement efficient algorithms for data storage and extraction. This branch was created to describe these classes, examples of working with them, as well as for suggestions on how to improve their work.

What is Generic? Generic is a special template classes that can store custom data types. In this case, the type is identified at the time of compilation, which allows you to achieve high performance.

Why Generic? Usually novice programmers are familiar with only one type of collection: an array. But there are many tasks where working with arrays is ineffective. Imagine that we have an array consisting of a million unique identifiers, for example, a thousand orders. How can we check whether in this thousand of orders, there is one order with number N? If we use one of the generic classes, this task can be accomplished almost immediately, in a constant amount of time, which does not depend on the number of elements to be searched among. There are other problems where the correct algorithm from the generic collection can be faster than the algorithm invented by the programmer.

This is an interesting topic.

Personally, in my opinion, there is nothing more efficient in programming than organizing data inside arrays and working correctly with these arrays in loops. This is the basis of the basics. All other solutions are derivatives, which take additional computer time and create overhead.

Global arrays, local arrays, loops and functions. Everything.

Those, who are skilful in these tools, will be ahead of all the others in efficiency.

imho.

 
Ivan Gurov:

I suggest to simplify the names - make them more logical. For example, is CArrayList an Array or List in mql5 the implementation of both?

This all leads to questions and confusion. IMHO, we should use stl instead of C# or Java. Or remove C in front of it, let it be just ArrayList.

...

On the contrary, I like C# coding very much.

 
fxsaber:

I wrote very clearly.

Look at what is highlighted.

Looked it up. Everything is written correctly. You were told that it takes an average of O(1) to find an item in the dictionary, i.e. instantly.
 
Vladimir Karputov:
If you can give examples, for example about searching among thousands of deals.

Ok.

 
Tag Konow:

This is an interesting topic.

Personally, my opinion on the subject is that there is nothing more efficient in programming than the ability to correctly organize data within arrays and correctly work with these arrays in loops. This is the basis of the basics. All other solutions are derivatives, which take additional computer time and create overhead.

Global arrays, local arrays, loops and functions. Everything.

Those, who can master these tools, will be ahead of all the others in efficiency.

imho.

Peter, please slow down. This is a discussion of the new SB classes, not your abstract statements. Please don't divert the topic. Thank you.

 
Artyom Trishkin:

Peter, please slow down. This is a discussion of the new SB classes, not your abstract statements. Please don't divert the topic. Thank you.

I have a right to express my opinion? Or is it intolerant to you?
 
Tag Konow:
Am I entitled to my opinion? Or is it intolerable to you?
No. because this opinion has already been expressed 100 times and here again with his samovar like oop is evil, etc. we have already heard enough of this opinion, we are sick of it.
 
Tag Konow:
Do I have the right to express my opinion? Or is it intolerable to you?

Your opinion is usually a treatise on War and Peace in three volumes. Therefore it is better to refrain.

Note - this is the second request from the moderator.

 
fxsaber:

O(n) is if you do it head-on.

No. O(n) is obtained due to hash collisions in very rare cases. These complexity estimates are for the optimal algorithm. The number of collisions is related to the memory overhead

In the usual case there is essentially no need to search, since having calculated the hash we essentially already know the location of the desired element