update the permutation algorithm from the text to


Update the permutation algorithm from the text to obtainthe correct list of permutations even if the string haves repeated letters. For example, if you call ListPermutations on the string "AABB", your program should not generate as many permutations as it does for the string "ABCD" because some of the strings generated by the standard algorithm would be indistinguishable from others. Your program should instead obtain the following six:

AABB

ABAB

ABBA

BAAB

BABA

BBAA

Write a new execution of ListPermutations that works correctly even if the string contains duplicated letters. In writing this execution, you should not merely keep a list of permutations that have already be encountered and avoid generating duplicates. Instead, you should think carefully about the recursive structure of the problem and find a way to avoid generating the duplicates in the first place. You may suppose the string haves only upper case letters from A to Z.

 

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: update the permutation algorithm from the text to
Reference No:- TGS0211808

Expected delivery within 24 Hours