forked from dannisliang/QPAlgorithm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfuncC.h
63 lines (58 loc) · 1.44 KB
/
funcC.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//
// Created by [email protected]
// 5/26/2019
//
#ifndef FUNC_C_H
#define FUNC_C_H
#include <sys/types.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <assert.h>
#include <memory.h>
#include <list>
#include <vector>
//求组合C(n,k)
class CFuncC {
public:
static void Print(std::vector<std::vector<int>>& vec);
static void Test();
static void Test1();
public:
CFuncC();
//深度遍历实现找规律
static int Depth();
//求组合C(n,k),返回数组集合
//arr((i0),...) = F(C(n,1))
//arr((i0,i1),...) = F(C(n,2))
//arr((i0,i1,i2),...) = F(C(n,3))
//arr((i0,i1,...ik),...) = F(C(n,k))
int FuncC(int n, int k, std::vector<std::vector<int>>& vec);
//求组合C(n,1)*C(n,1)...*C(n,1)
//f(k)=C(n,1)
//Multi(k)=f(1)*f(2)...*f(k)
//n int 访问广度
//k int 访问深度
//深度优先遍历,由浅到深,广度遍历,由里向外
int DepthVisit(int n, int k);
private:
//递归求组合C(n,k)
//f(k)=C(n,1)
//Multi(k)=f(1)*f(2)...*f(k)
//n int 访问广度
//k int 访问深度
//深度优先遍历,由浅到深,广度遍历,由里向外
int StaC(int n, int k, std::vector<std::vector<int>>& vec);
//递归求组合C(n,1)*C(n,1)...*C(n,1)
//n int 访问广度
//k int 访问深度
//深度优先遍历,由浅到深,广度遍历,由里向外
int DepthC(int n, int k);
private:
int c;
static int const KDEPTH = 13;
int e[KDEPTH + 1];
std::vector<int> v;
};
#endif