hjh132's Blog
If a thing is worth doing it is worth doing well.
posts - 20,comments - 9,trackbacks - 0
public static void permute (char [] str, int low, int high)
    
{
        
if (low > high)
        
{
            System.out.print(str);
            System.out.print(
" ");
        }

        
else
        
{
            
for (int i = low; i <= high; i++)
            
{
                
char[] temp = str.clone(); //temp will be str
                temp[i] = str[low]; //with i and low
                temp[low] = str[i]; //swapped
                permute(temp,low+1,high);
            }

        }

    }

posted on 2008-02-22 10:26 101℃太阳 阅读(368) 评论(0)  编辑  收藏 所属分类: 代码民工

只有注册用户登录后才能发表评论。


网站导航: