如何找到递归关系并解决该关系并对其进行证明?

时间:2019-05-30 18:42:08

标签: algorithm function recurrence

找到一个递归函数,该函数产生集合A = {1,2,...,n}的所有子集。找到递归关系。解决关系并证明它

对于这些问题,我真的无法解决。

static void powerSet(String str, int index, String curr)  
{  
    int n = str.length();  

    // base case  
    if (index == n) 
    {  
        System.out.println(curr); 
        return;  
    }  

    powerSet(str, index + 1, curr + str.charAt(index));  
    powerSet(str, index + 1, curr); 

}  

0 个答案:

没有答案
相关问题