📄 permute.h
字号:
// randomly permute an array
#ifndef Permute_
#define Permute_
#include <stdlib.h>
#include "swap.h"
template <class T>
void Permute(T a[], int n)
{// Permute a[0:n-1].
for (int i = n - 1; i > 0; i--)
// swap a[i] with a randomly selected element
// from a[0:i]
Swap(a[i], a[random(i+1)]);
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -