Vincany Posted February 12, 2019 Report Share Posted February 12, 2019 If there is a word , then will swapping 2 adjacent letters at the beginning of string will give me a new word (not necessarily a meaningful word) and then swapping the next 2 letters will give me a new word. After switching the last 2 letters , we go back to the beginning of the word and continue.example: If the word is ABCCD , it becomes BACCD , then BCACD , BCCAD, BCCDA, then CBCDA and so on .. Ignoring the swapping of the same two letters (like BCCDA) , will this algorithm give me all the words of all permutations ? I Tried for few number of letters and it works , but I want to know how to prove for any no. of letters. I have no idea how to prove it , it seems to work . By the way ,it is not a puzzle . Quote Link to comment Share on other sites More sharing options...
Thalia Posted February 14, 2019 Report Share Posted February 14, 2019 It looks like you're taking the first letter and essentially rotating it through the different positions while the other letters remain in the same order. I noticed that all the possible permutations begin with two letters that were next to each other in the original sequence (or in the first and last spot). For example, I don't think you can get a sequence starting with AC. So this does not seem to hold up. 1 Quote Link to comment Share on other sites More sharing options...
Vincany Posted February 15, 2019 Author Report Share Posted February 15, 2019 Yes , I see that some of the permutations do not show up. Thanks! Quote Link to comment Share on other sites More sharing options...
phil1882 Posted January 16, 2020 Report Share Posted January 16, 2020 there is a way however to permute through all possibilities by swapping two letters. ABC -> ACB -> BCA -> BAC -> CAB -> CBA ABCD -> ABDC -> ACDB -.> ACBD -> ADBC -> ADCB -> BDCA -> BDAC -> BADC -> BACD -> BCAD -> BCDA -> CBDA -> CBAD -> CABD -> CADB -> CDAB -> CDBA-> DCBA -> DCAB -> DBAC -> DBCA -> DACB -> DABC Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.