Talk:Order two numerical lists: Difference between revisions

Content added Content deleted
(suggested changes)
Line 49: Line 49:


==Stable Sort??==
==Stable Sort??==
: Where did this requirement come from? There was nothing about sorting only comparison. Neither list is touched. There is no merge or no sort. Did I miss something? --[[User:Dgamey|Dgamey]] 03:24, 30 November 2011 (UTC)
Where did this requirement come from? There was nothing about sorting only comparison. Neither list is touched. There is no merge or no sort. Did I miss something? --[[User:Dgamey|Dgamey]] 03:24, 30 November 2011 (UTC)
:: Rereading this the description as it stands could mean either sort or determine with list is less. If it's a sort, should not the task name be Sort two numerical lists? --[[User:Dgamey|Dgamey]] 03:46, 30 November 2011 (UTC)
: Rereading this the description as it stands could mean either sort or determine with list is less. If it's a sort, should not the task name be Sort two numerical lists? --[[User:Dgamey|Dgamey]] 03:46, 30 November 2011 (UTC)
:: Since the task doesn't seem to have anything to do with sorting, I removed the mention of stable sort for now. I guess the intention was that if the cmp function is used for a comparison based sorting, it should produce a stable sort result. If so, it's bunk: sort stability depends more on the sort method than the comparator.
:: Another thing, it might be better to omit some detailed requirement about the cmp result. To be practical, the cmp routine should be able to decide on the ording. For example, it's likely more useful for a comparison function to be tri-state instead of true/false; it's not necessarily desirable to sort shorter lists before longer ones (one may prefer padding by zero, i.e. (1, 2, -1) < (1, 2) < (1, 2, 1), rather than padding by -inf, i.e. (1, 2) < (1, 2, -1) < (1, 2, 1)). --[[User:Ledrug|Ledrug]] 04:33, 30 November 2011 (UTC)


==Lexicographic order==
==Lexicographic order==
Isn't lexicographic order the one where the integer 100 comes before the integer 11? That is, I thought that it was a character set based comparison rather than a numeric comparison. [[User:Stormneedle|Stormneedle]] 04:26, 30 November 2011 (UTC)
Isn't lexicographic order the one where the integer 100 comes before the integer 11? That is, I thought that it was a character set based comparison rather than a numeric comparison. [[User:Stormneedle|Stormneedle]] 04:26, 30 November 2011 (UTC)
: No. "Lexicographic" only refers to the list as whole, not when comparing its individual elements. The elements are compared by whatever is natural, which probably means numerical comparison function (100 > 11, 11 > 2). --[[User:Ledrug|Ledrug]] 04:33, 30 November 2011 (UTC)