Talk:Sort an array of composite structures: Difference between revisions

From Rosetta Code
Content added Content deleted
(Is "array of composite structure" same as "associative array"?)
(not an associative array, but definitively a sort using custom comparator)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
This problem appears to be very similar to the problem "Sort an array using a custom comparator". Please explain the difference.
This problem appears to be very similar to the problem "Sort an array using a custom comparator". Please explain the difference.
-- Waldorf 2007, 08, 11
-- Waldorf 2007, 08, 11

Could this be renamed "Sort an associative array"? If not, why not? Waldorf's question is similar and good. The sorting tasks may deserve broader reassessment. --[[User:TBH|TBH]] 15:04, 10 January 2008 (MST)
Could this be renamed "Sort an associative array"? If not, why not? Waldorf's question is similar and good. The sorting tasks may deserve broader reassessment. --[[User:TBH|TBH]] 15:04, 10 January 2008 (MST)

: No it couldn't, because it's not an associative array (it still is indexed with a numeric index). It could be part of an associative array implementation, though.
: According to Waldorf's comment: This is indeed not just similar, but a special case of sorting using a custom iterator. Unless some language provides explicit support for sorting for a structure field, this task doesn't give you anything new compared with the other task, except maybe for structure element access (but for that, IMHO a more basic task should be created). --[[User:Ce|Ce]] 12:56, 11 January 2008 (MST)

Latest revision as of 19:56, 11 January 2008

This problem appears to be very similar to the problem "Sort an array using a custom comparator". Please explain the difference. -- Waldorf 2007, 08, 11

Could this be renamed "Sort an associative array"? If not, why not? Waldorf's question is similar and good. The sorting tasks may deserve broader reassessment. --TBH 15:04, 10 January 2008 (MST)

No it couldn't, because it's not an associative array (it still is indexed with a numeric index). It could be part of an associative array implementation, though.
According to Waldorf's comment: This is indeed not just similar, but a special case of sorting using a custom iterator. Unless some language provides explicit support for sorting for a structure field, this task doesn't give you anything new compared with the other task, except maybe for structure element access (but for that, IMHO a more basic task should be created). --Ce 12:56, 11 January 2008 (MST)