Talk:Sorting algorithms/Strand sort: Difference between revisions

 
(5 intermediate revisions by 3 users not shown)
Line 44:
</lang>
:::[[User:Fwend|Fwend]] 00:44, 4 August 2012 (UTC)
:::: If you think you have found a Phobos bug, I suggest to add an entry in the D Bugzilla.[[User:Bearophile|bearophile]]
::::: Are you sure it's a bug? The original code was modifying <code>list</code> while doing a <code>foreach</code> on it, how was the program supposed to behave regarding the validity of the iterator? Also, <code>linearRemove(list[].find())</code> really doesn't make sense when you are sitting right at the location you want to remove. --[[User:Ledrug|Ledrug]] 04:24, 4 August 2012 (UTC)
:::::: Your solution is fine. linearRemove is supposed to be stable, (there's also stableLinearRemove, but it's nothing but an alias for linearRemove) so I think I should have been able to use it. <strike>Also, searching for the item or copying the list is just as expensive so it makes little difference.</strike>.[[User:Fwend|Fwend]] 09:59, 4 August 2012 (UTC)
::::::: I'm curious about D's DList stuff: is <code>a.insertBack(b.first); b.removeFront();</code> the only way to unlink first element of b and append it to a? It has the appearance of dealloc/alloc'ing a <code>Node</code> at each step, which would seem to be a waste, but I don't know D, so I could simply have the wrong impression here. --[[User:Ledrug|Ledrug]] 07:06, 8 August 2012 (UTC)
:::::::: The Nodes are declared private and never exposed. Functions like "front" return the payload of the Node, never the Node itself. So "item" is an int in our case. [[User:Fwend|Fwend]] 11:10, 8 August 2012 (UTC)
Anonymous user