Talk:Order two numerical lists: Difference between revisions

From Rosetta Code
Content added Content deleted
(Created page with "The task description should clarify what should happen for two equal lists. Right now the description seems inconsistent. It says "return true if the first list should be ordere...")
 
No edit summary
Line 2: Line 2:


Right now the description seems inconsistent. It says "return true if the first list should be ordered before the second", but should a list be ordered before itself? It seems that it should not.
Right now the description seems inconsistent. It says "return true if the first list should be ordered before the second", but should a list be ordered before itself? It seems that it should not.
: if both lists are the same then, they still have to go in some order. so there is no inconsistency. you can not ''not'' order them. which order they go then depends on the comparison though, and that affects whether the sort is stable or not. as it is defined the task does not expect the solution to produce a stable sort. such a requirement could be added, but then the existing solutions need to be reviewed. since both stable and unstable sort have legitimate uses i don't want to make unstable sort wrong. it could be added as extra credit though--[[User:EMBee|eMBee]] 02:30, 30 November 2011 (UTC)

But reading the algorithm description: "... and so on, until one of the list has no more elements. If the first list runs out of elements the result is true." It seems that it should return true for two equal lists, since both lists would run out of elements at the same time.
But reading the algorithm description: "... and so on, until one of the list has no more elements. If the first list runs out of elements the result is true." It seems that it should return true for two equal lists, since both lists would run out of elements at the same time.
:if the first list is tested first, and the second list is not tested, the effect is that if both are equal, the result will be true.--[[User:EMBee|eMBee]] 02:30, 30 November 2011 (UTC)


Whatever is decided, some of the solutions will be incorrect and will need to be changed. --[[User:Spoon!|Spoon!]] 23:55, 29 November 2011 (UTC)
Whatever is decided, some of the solutions will be incorrect and will need to be changed. --[[User:Spoon!|Spoon!]] 23:55, 29 November 2011 (UTC)

Revision as of 02:30, 30 November 2011

The task description should clarify what should happen for two equal lists.

Right now the description seems inconsistent. It says "return true if the first list should be ordered before the second", but should a list be ordered before itself? It seems that it should not.

if both lists are the same then, they still have to go in some order. so there is no inconsistency. you can not not order them. which order they go then depends on the comparison though, and that affects whether the sort is stable or not. as it is defined the task does not expect the solution to produce a stable sort. such a requirement could be added, but then the existing solutions need to be reviewed. since both stable and unstable sort have legitimate uses i don't want to make unstable sort wrong. it could be added as extra credit though--eMBee 02:30, 30 November 2011 (UTC)

But reading the algorithm description: "... and so on, until one of the list has no more elements. If the first list runs out of elements the result is true." It seems that it should return true for two equal lists, since both lists would run out of elements at the same time.

if the first list is tested first, and the second list is not tested, the effect is that if both are equal, the result will be true.--eMBee 02:30, 30 November 2011 (UTC)

Whatever is decided, some of the solutions will be incorrect and will need to be changed. --Spoon! 23:55, 29 November 2011 (UTC)