8.1 水题

8.2 Imagine a robot sitting on the upper left hand corner of an NxN grid The robot can only move in two directions: right and down How many possible paths are there for the robot?

FOLLOW UP
Imagine certain squares are “of limits”, such that the robot can not step on them
Design an algorithm to get all possible paths for the robot

http://www.cnblogs.com/graph/p/3258531.html

http://www.cnblogs.com/graph/p/3258555.html

8.3 Write a method that returns all subsets of a set(所有子集系列)

http://www.cnblogs.com/graph/p/3216589.html

http://www.cnblogs.com/graph/p/3216496.html

8.4 Write a method to compute all permutations of a string (所有排列系列)

http://www.cnblogs.com/graph/p/3216100.html

http://www.cnblogs.com/graph/p/3215299.html

http://www.cnblogs.com/graph/p/3297845.html

http://www.cnblogs.com/graph/p/3224053.html

8.5 Implement an algorithm to print all valid (e g , properly opened and closed) combinations of n-pairs of parentheses

EXAMPLE:
input: 3 (e g , 3 pairs of parentheses)
output: ()()(), ()(()), (())(), ((()))

http://www.cnblogs.com/graph/p/3194497.html

8.6   水题

8.7Given an infnite number of quarters (25 cents), dimes (10 cents), nickels (5 cents) and  pennies (1 cent), write code to calculate the number of ways of representing n cents

int a[] = {, , , };
int makeChange(int n, int index)
{
assert(index >= && index <= );
if(a[index] == ) return ;
int way = ;
for(int i = ; i * a[index] <= n; ++i)
way += makeChange(n - i * a[index], index+); return way;
}

8.8Write an algorithm to print all ways of arranging eight queens on a chess board so  that none of them share the same row, column or diagonal

http://www.cnblogs.com/graph/archive/2013/07/30/3226728.html

CCI_chapter 8 Recurision的更多相关文章

  1. CCI_chapter 19 Moderate

    19 1  Write a function to swap a number in place without temporary variables void swap(int &a, i ...

  2. CCI_chapter 16 Low level

    16.5 Write a program to find whether a machine is big endian or little endian Big-Endian和Little-Endi ...

  3. CCI_chapter 13C++

    13.9Write a smart pointer (smart_ptr) class template<class T>class SmartPoint{ public: SmartPo ...

  4. CCI_chapter 4 trees and Grapths

    4.1Implement a function to check if a tree is balanced For the purposes of this question,a balanced ...

  5. CCI_chapter 3 Stacks and Queues

    3.1Describe how you could use a single array to implement three stacks for stack 1, we will use [0, ...

  6. CCI_chapter 2 Linked Lists

    2.1  Write code to remove duplicates from an unsorted linked list /* Link list node */ struct node { ...

  7. CCI_chapter 1

    1.1Implement an algorithm to determine if a string has all unique characters What if  you can not us ...

  8. Linux系统下搭建DNS服务器——DNS原理总结

    2017-01-07 整理 DNS原理 域名到IP地址的解析过程 IP地址到域名的反向域名解析过程 抓包分析DNS报文和具体解析过程 DNS服务器搭建和配置 这个东东也是今年博主参见校招的时候被很多公 ...

  9. <<C++ Primer>> 第 6 章 函数

    术语表 第 6 章 函数 二义性调用(ambiguous call): 是一种编译时发生的错误,造成二义性调用的原因时在函数匹配时两个或多个函数提供的匹配一样好,编译器找不到唯一的最佳匹配.    实 ...

随机推荐

  1. 黑马程序员_Java集合Map

    Map Map概述: 接口Map<k,v> 类型参数: k-此映射所维护的键的类型 v-映射值的类型 Map集合:该集合存储键值对.一对一对往理存.而且要保证键的唯一性. 嵌套类摘要: s ...

  2. typedef与define的区别

    1) #define是预处理指令,在编译预处理时进行简单的替换,不作正确性检查,不关含义是否正确照样带入,只有在编译已被展开的源程序时才会发现可能的错误并报错.例如:#define PI 3.1415 ...

  3. 联系我们_站内信息_站内资讯_网上定制衬衫|衬衫定制|衬衫定做-ChenShanLe衬衫乐

    联系我们_站内信息_站内资讯_网上定制衬衫|衬衫定制|衬衫定做-ChenShanLe衬衫乐 衬衫乐定制网是国内领先的成衣定制机构,专业从事衬衫网络在线定制.高级定制服装的价格不菲,而衬衫乐运用了&qu ...

  4. Swing UI - 可收起与开展内容面板实现演示

    基于JAVA Swing实现的自定义组件可折叠的JPanel组件 基本思想: 可折叠面板,分为两个部分-头部面板与内容面板 头部面板– 显示标题,以及对应的icon图标,监听鼠标事件决定内容面板隐藏或 ...

  5. spring中获取Bean

    在测试类中我们获取已经装配给容器的Bean的方法是通过ApplicationContext,即 ApplicationContext ac=new ClassPathXmlApplicationCon ...

  6. Fancybox——学习(1)

    转载:http://www.helloweba.com/view-blog-65.html Fancybox是一款优秀的jquery插件,它能够展示丰富的弹出层效果.前面我们有文章介绍了facybox ...

  7. 【架构师之路】依赖注入原理---IoC框架

    1 IoC理论的背景    我们都知道,在采用面向对象方法设计的软件系统中,它的底层实现都是由N个对象组成的,所有的对象通过彼此的合作,最终实现系统的业务逻辑.  图1:软件系统中耦合的对象 如果我们 ...

  8. UI Prototype Design IDE( 界面原型设计工具 )

    UI Prototype Design IDE( 界面原型设计工具 )   如何用工具去与客户进行交流,互动,定义要做的系统,什么什么的... 0.Balsamiq Mockups http://ww ...

  9. Linux下一些基本操作

    一.忘记root密码 1. sudo passwd root 2. 输入新密码. 二.查看内核版本: 1.查看内核版本命令:1) cat /proc/version 2) uname -a 3)  u ...

  10. Linux下rar unrar的安装

    Linux下rar unrar的安装: 以3.8.0版本为例,如果是64位平台,执行以下命令,也可以去官方网站:)下载最新版: wget http://www.rarlab.com/rar/rarli ...