c语言全排列问题伪代码及流程图
时间: 2024-05-01 13:21:32 浏览: 90
流程图和伪代码.doc
5星 · 资源好评率100%
伪代码:
```
void permute(char* str, int start, int end)
{
if(start == end)
{
print(str);
}
else
{
for(int i = start; i <= end; i++)
{
swap(str[start], str[i]);
permute(str, start + 1, end);
swap(str[start], str[i]);
}
}
}
```
流程图:
```
start permute(str, start, end)
|
|__ if start == end
| print str
|
|__ else
| for i = start to end
| swap str[start], str[i]
| permute(str, start + 1, end)
| swap str[start], str[i]
|
end
```
阅读全文