Print all the permutations of a string in C

前端 未结 8 1453
自闭症患者
自闭症患者 2020-11-29 04:06

I am learning backtracking and recursion and I am stuck at an algorithm for printing all the permutations of a string. I solved it using the bell algorithm for permutation b

8条回答
  •  感情败类
    2020-11-29 04:57

    I create more specific but not efficient Program for permutation for general string.
    It's work nice way.
    //ubuntu 13.10 and g++ compiler but it's works on any platform and OS
    //All Permutation of general string.
    
    #include
    #include
    #include
    #include
    using namespace std;
    int len;
    string str;
    
    void permutation(int cnum)
    {
        int mid;
        int flag=1;
        int giga=0;
        int dead=0;
        int array[50];
        for(int i=0;i
                                                            
提交回复
热议问题