Thanks to the author for a great article!
there are other who-what? kind of an incomplete idea.
So, the capabilities of a node for a doubly-linked list will be similar to those of a singly-linked node, except that you still need to handle a pointer to the previous node.
Is it necessary to process a pointer to the previous node to have the capabilities of a singly-linked node? The author has got the point he wanted to convey, but the wording itself is not very good.....
Fig.3 Nodes for a ring bilinked list
1) the topmost pointer - the arrow is a bit crooked
2) I realise that this may be the style of the articles - but the description of the figure is in very small font and rather dim (personal opinion of poor eyesight).
We will also need such a node that will serve the needs of a doubly-linked list. It differs from the previous form in that it holds another pointer that refers to the previous node. And naturally, such a node of the head element of the list will be equal to NULL.
1) From the previousform - from what? How much previous? Why should I search that by previous the author means "Node for a single-linked list", or maybe I'm wrong.
2) "thenode of the head element of the list will be equal to NULL". Node, or pointer?Perhaps in view of the earlier statement "You can store nodes, not elements, in a list." it would be more correct to say:
" one of the pointers of the head node ofa doubly-linked listwill be equal to NULL" .
But in the tail node, the link to the next node will not be empty, because it will be filled with the head pointer.
1) there will be no reference - there will be no who-what ???? cases don't hold
2) But in the tail node, there will be no reference to the next empty (who-what ????). unfinished thought
3) It (the reference) will be filled with an index. Will the link be filled by the pointer, or will the pointer still have a reference somewhere ????.
As for the delete operations, they almost duplicate the similar ones from the add group:
- delete head node;
- delete the tail node;
- remove a node from the specified place in the list;
- destructor.
1) they practically duplicate the similar (who-what????) ones from the add group. Again an incomplete thought
2) isn't delete a node from a specified list location a general case of "to delete the head node" and "delete the tail node" ??? similarly for add
3)"Regarding deletionoperations ", and before that it was "The following can be considered as methods of adding:" ( there methods, here operations - I want the same format).
This is so, a personal opinion about the introductory part from an ignorant person, for whom these very introductory parts of the article are created.
I liked it. Thank you. It's good when after reading it you get ideas where you can apply it in your own place. )
tol64, thanks for the opinion of an authoritative expert :-)
I don't consider myself an expert and I don't consider myself an authority either. And it's not from modesty, it really is. ))) There are programmers here who are many times more experienced in programming, mathematics and trading. And I still have to swim and swim. )))
I think authority is a subjective thing. It's like the recognition of one country's sovereignty by another country....
Quote:
Authority consists in the recognition of the subject (carrier) of outstanding achievements, knowledge, skills, abilities, his special position in society...
So, yours is recognised by me :-)
tol64, we are waiting for your new articles.
- ru.wikipedia.org
Here is such a code for an example of access to the elements of the data set:
Where did you find binary access to CList elements with log2(N) complexity!?
CList is a list, and binary access with log2(N) complexity requires a momentary jump to a node with index CurrentIndex +/- (CurrentIndex/2), where CurrentIndex is the current node in the list.
The CList implementation uses the standard QuickSearch(), which in the case of sorting does indeed search for an item by referring to the CurrentIndex +/- (CurrentIndex/2) node. However, this node itself is searched by the GetNodeAtIndex() function, and there are no miracles in it. The whole complexity of the access operation falls on it, specifically on these strings:
if(revers) { //--- search from right to left for(;i>index;i--) { result=result.Prev(); if(result==NULL) return(NULL); } } else { //--- search from left to right for(;i<index;i++) { result=result.Next(); if(result==NULL) return(NULL); } }
Looking at them, it becomes clear that the complexity of searching for an element is O(N/2) in the limit, because the list is bidirectional, so access to an element from one of the ends will not exceed N/2 transitions. The author would be well advised to understand the algorithm more thoroughly before writing an article about it.
From my own experience I can say that since working with data is almost always connected with searching and sorting them, it is almost always inefficient to use the classical CList for real tasks. List is strong first of all in combined collections, where access by index is combined with access by list.
For some reason, few people think about the fact that a pointer transition is much, much slower than direct addressing by index. Going through result.Next() a thousand times is much slower than going through the index a thousand times in for.
A coma.
Starting right from the images. The pointer goes to the node, not the data, the data is only a part of the node, i.e. there is a conflict with the implementation and potential confusion.
The text is mostly normal, to be fair.
On implementation. Such things are implemented by templates. The optimal variant of representation of containers in STL, though here with iterators and functors is a failure, though you can probably think of something.
As a result, your empty virtual methods look not just incomprehensible, but just vryviglaz. The ) sheet sorting has delivered. Implementation and even declaration of some methods is questionable and even perplexing.
Zero encapsulation.
Revelations about complexity and binary(!) search at the list(! gg) finished.
As a result, we have a current just EVERYTHING incomprehensible and inconvenient crap, not usable even as an example for learning (imho).
No offence ) if you want to become a programmer learn to program NORMALLY. You are able to implement it much better.
Looking at them, it is immediately clear that the complexity of finding an element is in the limit O(N/2), because the list is bidirectional, so accessing an element from one end will not exceed N/2 transitions. The author would do well to understand the algorithm more thoroughly before writing an article about it.
You would also do well to refresh your memory, what is O, written above is firstly incorrectly calculated, and secondly incorrectly written down.
_____________________________________
The most interesting thing is that this is far from the worst resource article.
...
No offence ) you want to be a programmer learn to program NORMALLY. You are able to realise it much better.
You would also do well to refresh your memory, what is O, written above is firstly incorrectly calculated, secondly incorrectly written.
...

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
New article MQL5 Programming Basics: Lists has been published:
The new version of the MQL language has provided developers of automated trading systems with effective tools for the implementation of complex tasks. One cannot deny the fact that the programming functionalities of the language have been considerably expanded. The MQL5 OOP features alone are worth a lot. Furthermore, the Standard Library should not go unmentioned. Judging by the error code number 359, class templates will be supported soon.
In this article, I would like to bring up what may in some way be an expansion or continuation of the subjects describing data types and their sets. Here, I would like to make reference to an article published on the MQL5.community website. A very detailed comprehensive description of the principles and logic of working with arrays was provided by Dmitry Fedoseev (Integer) in his article "MQL5 Programming Basics: Arrays".
So, today I propose to turn to lists, and more precisely, to linked linear lists. We will start with list structure, meaning and logic. After that, we will consider the related tools already available in the Standard Library. In conclusion, I'll provide examples of how lists can be used when working with MQL5.
Fig. 1 Nodes in a singly linked list
Author: Dennis Kirichenko