Talk:Anagrams/Deranged anagrams
Cross-language performance comparisons
+1 on Ledrugs deletions. Anothers persons comparison could be wildly different. --Paddy3118 04:53, 27 September 2011 (UTC)
User user:79.11.51.165 commented:
- "qualitative performance comparisons done on the same PC are probably OK on Rosettacode"
when removing the comment on a comparison between two examples in the same language, D. Too many things have to be set-up and monitored as equivalent, as well as reported as equivalent for all but the fuzziest of reports on relative performance between examples in the same language to be reported, as otherwise their would need to be a wealth of qualifying information. In general, as you can see, there is very little timing information on RC, but the odd comment along the lines of "This second D example consistantly ran faster than the other" is usually left, but even this implies things about the test environment, as well as the code itself, as who is likely to re-run to confirm fuzzy timings when code edits are made, and such a comment might assume a particular compiler version. If you start to add all that extra context explicitely you then don't know when to stop... (I shall stop here howev
--Paddy3118 05:11, 27 September 2011 (UTC)
Comment on Applescript comment
"The task description implies that there's just one longest deranged anagram in the file, so this solution only examines instances where exactly two words share the same characters and returns the first longest deranged pair found."
- It seems that finding the longest would need to find all derangement lengths to determine the longest, but I guess only one of maximum current length would need to be retained in a possible algorithm.
"... a policy about what to do where three or more words share the same characters and at least one is deranged against all the others but the others aren't necessarily deranged amongst themselves."
- Deranged pairs could be shown with possible repetition between pairs of a single word.
- --Paddy3118 (talk) 17:46, 29 October 2020 (UTC)
- Hi Paddy3118. Thanks for your interest in the AppleScript solution and in my comments. The second sort in the AppleScript code sorts the words by length as well as grouping them by the letters they contain, so the rest is just working through the list from longest to shortest. It would be easy to adapt the last part to return co-longest deranged pairs.
Anagrams with most derangements?
- Your discussion motivated me to check my AWK solution to the task. When I wrote it I decided the best way to find the maximum length derangement was to start with the longest words in the dictionary file and work down. As was noted, it happens that there was only one pair of length 10. However, working down to length 9, 8, 7, ... I found 3 pairs of length 9: englander/greenland, broadside/sideboard, ancestral/lancaster. At length 8 there are 16 pairs. At length 7 I found 26 pairs. Of these the most interesting are frantic/infarct, frantic/infract, algenib/belgian and algenib/bengali, which are examples of "three or more words share the same characters and at least one is deranged against all the others but the others aren't necessarily deranged amongst themselves." I did not deliberately design this behavior (I didn't think of it) but I did design it to find all pairs. Thank you for the motivation to check. Dmclapp (talk) 20:00, 30 October 2020 (UTC)
- Thank you for those examples. It might be a bit late now, but "Find the distinct words sharing all the same characters producing the largest number of Deranged pairs between them" might have been a stretch goal to add now you have produced your results. Maybe something for this talk page? Hmm... --Paddy3118 (talk) 04:08, 31 October 2020 (UTC)
- I found better wording for the above and slotted in some Python code to compute them. --Paddy3118 (talk) 09:28, 31 October 2020 (UTC)