Talk:Sort the letters of string in alphabetical order: Difference between revisions

Request collation and sample input/output
(Request collation and sample input/output)
Line 71:
: I might suggest your Slacksort is a variant of [[Sorting_algorithms/Selection_sort]] except that one inefficiency of the latter is it can make multiple passes down the rest of the array in order to obtain the same minimum value, whereas one inefficiency of the former is it <del>can</del> will make multiple passes down the entire array that achieve nothing.
: Plus as written it does not appear it can actually be used as a sort method, as in s := Slacksort(s), and is integer/char-only. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 20:15, 25 July 2021 (UTC)
 
== Request collation and sample input/output ==
The task appears to require a collation sequence, but doesn't clearly specify. Further, title says "''letters'' in ''alphabetical'' order", while task says "''characters'' in ''lexicographical'' order". (I would presume task description as more-authoritative than title) It also isn't clear how to sort upper/lower of same letter - does sort("CcBbAa") → "aAbBcC" or → "AaBbCc"? (dictionaries and phone books often disagree on that point) Numeric characters will have a "natural for your language" order, but what about punctuation characters, et al? Which comes first: comma or period? And do those come before zero? And so on for every other ''character'' to be considered. Author seems to assume this "natural" order is self-evident; I think it's not. ASCII or EBCDIC or UTF or similar are certainly '''NOT''' "natural" to any language (that I'm aware of!) so let's rule those out. I'd propose presenting an input string of all characters to be considered, as well as an output string showing the desired sequencing (i.e. the ''answer'' for given input). Further, it would be helpful to specify what to do with any characters encountered that ''aren't'' in the input string - discard? keep-in-place where encountered? append-at-end unsorted in order of encounter? (several other possibilities here) Additionally, if the collation sequence is indeed the focus of this task, then perhaps the (seemingly odd) final line of the task description (Write the function even if your language has a built-in function for it.) perhaps becomes unneccessary - because then the task would really be about writing the ''comparator'' rather than the ''sorter'', so why not allow a built-in sort if available? --[[User:Davbol|Davbol]] ([[User talk:Davbol|talk]]) 19:11, 12 August 2022 (UTC)
Anonymous user