码迷,mamicode.com
首页 > 其他好文 > 详细

28.字符串的排列

时间:2017-04-26 12:55:24      阅读:173      评论:0      收藏:0      [点我收藏+]

标签:++   class   enter   http   str   ace   fonts   sdn   text   

技术分享

技术分享

void Permutation(char*  pStr)
{
if (pStr == NULL)
return;
Permutation(pStr, pStr);
}
void Permutation(char* pStr, char* pBegin)
{
if (*pBegin == ‘\0‘)
{
printf("%s\n", pStr);
}
else
{
for (char* pCh = pBegin; *pCh != ‘\0‘; ++pCh)
{
char temp = *pCh;
*pCh = *pBegin;
*pBegin = temp;
Permutation(pStr, pBegin + 1);
temp = *pCh;
*pCh = *pBegin;
*pBegin = temp;
}
}
}

技术分享

技术分享

技术分享

技术分享

技术分享

技术分享

技术分享




28.字符串的排列

标签:++   class   enter   http   str   ace   fonts   sdn   text   

原文地址:http://www.cnblogs.com/wzjhoutai/p/6767897.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!