如何生成所有矢量排序方法

时间:2020-03-06 09:29:27

标签: c++

我有一个编程练习,您需要找到安排矢量的所有方式,我进行了搜索,它向我展示了如何生成所有子集。 p.s在练习中类似1 2 3 4和4 3 2 1的计数是两种方式。

1 个答案:

答案 0 :(得分:3)

打印所有排列的可能方法是使用std::next_permutation

at NamespacedReflect.getMetadata (/node_modules/@loopback/metadata/src/reflect.ts:49:20)
at Function.getClassMetadata (/node_modules/@loopback/metadata/src/inspector.ts:63:19)
at getJsonSchema (/node_modules/@loopback/repository-json-schema/src/build-schema.ts:89:36)
at Object.getJsonSchemaRef (/node_modules/@loopback/repository-json-schema/src/build-schema.ts:140:33)
at Object.getModelSchemaRef (/node_modules/@loopback/openapi-v3/src/controller-spec.ts:495:22)
at Object.<anonymous> (/src/controllers/api-credential.controller.ts:38:40)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/src/controllers/index.ts:1:1)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)