recursion demo(problem from Stanford cs106b course reader)
来源:互联网 发布:淘宝助理是做什么工作 编辑:程序博客网 时间:2024/05/22 07:16
#include <iostream>using namespace std;int NumberOfPartitions(int array[], int length, int target);int main(){int sampleSet[] = {1, 3, 4, 5};int sz = sizeof(sampleSet) / sizeof(int);cout << NumberOfPartitions(sampleSet, sz, 5) << endl << NumberOfPartitions(sampleSet, sz, 11) << endl;return 0;}int NumberOfPartitions(int array[], int length, int target){// simple caseif (length == 0) {if (target == 0) return 1;else return 0;}return NumberOfPartitions(array, length-1, target-array[length-1]) + NumberOfPartitions(array, length-1, target);}
0 0
- recursion demo(problem from Stanford cs106b course reader)
- stanford cs106b recursion demo
- BST(Binary Search Tree) demo, quote from Stanford cs106b course reader
- stanford cs106b mutual recursion demo
- stanford cs106b random.h demo
- 转载自stanford cs106L course reader Generic Programming demo
- stanford cs106b GCD(x, y) demo
- solve 3*3 magic square problem using recursive backtracking(using Stanford CS106b ADT library)
- Online Learning(from Cousera Course of Stanford University)
- recursion demo
- cs106b DigitSum recursive implementation demo
- deep learning ---- Stanford course
- binary tree recursion problem
- java console program demo quote from Stanford cs106a, "the art and science of java"
- convex optimization from stanford
- recursion problem(IsMeasurable)(Is this correct?)
- [数据结构]N-Queens Problem(recursion)
- [VAB] txt reader -from Chirstina
- iOS 内核堆利用技术点之 mach_msg ool
- 面试题30:最小的K个数
- 从多层感知器到卷积网络(一)
- 2.感知器学习算法(待修)
- poj3026(bfs+prime)
- recursion demo(problem from Stanford cs106b course reader)
- uva 12470(矩阵快速幂)
- Java中的运行期类型鉴定
- AE加载地图时报错:The operation was attempted on an empty geometry.
- uva live 3882 And Then There Was One 约瑟夫环
- 麻省--算法导论
- Android_开源框架_Volley(Google IO 2013)源代码及内部实现分析
- 使用VMI获取服务器端物理内存、CPU
- crc算法的核心思想