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. use "man rsyslogd" for details. To run rsyslog interactively, use "rsyslogd -n"to run it in debug mo

    zjtest7-frontend:/root# service rsyslog start Starting system logger: usage: rsyslogd [options] use ...

  2. 附加、分离数据库和备份、还原数据库的区别(转载于中雪的BLOG)

    备份和恢复的概念: 备份和恢复组件是SQL Server的重要组成部分.备份就是指对SQL Server数据库及其他相关信息进行拷贝,数据库备份记录了在进行备份这一操作时数据库中所有数据的状态,如果数 ...

  3. windows 触发桌面图标布局保存

    问题: 项目原有的一套结构由于引进了一个磁盘套件,类似于关闭系统的explorer.exe进程,进入到他所维护的explorer.exe中.于是出现了当退出磁盘的时候没有保存好桌面布局信息导致下次进入 ...

  4. 2016年如何选择 Linux 发行版

    不管是在企业级应用还是在消费者领域,2015 对于 Linux 来说都是极其重要的一年.作为一个从 2005 年就开始使用 Linux 的老用户,我有幸见证了 Linux 过去这 10 年里的重大发展 ...

  5. Linux grep 命令中的正则表达式详解

    在 Linux .类 Unix 系统中我该如何使用 Grep 命令的正则表达式呢? Linux 附带有 GNU grep 命令工具,它支持扩展正则表达式(extended regular expres ...

  6. HTML与CSS简单页面效果实例

    本篇博客实现一个HTML与CSS简单页面效果实例 index.html <!DOCTYPE html> <html> <head> <meta charset ...

  7. Nginx各个配置块功能详解

    Nginx学习笔记-入门篇 nginx初探 ginx服务器是轻量级web服务器中广受好评的一款产品,常用功能有HTTP代理与反向代理(目前已支持七层与四层代理),负载均衡,web缓存. nginx配置 ...

  8. 【微信公众号】验证用户OpenID是否关注某个公众号

    1.获取OpenID #region 获取微信支付的OpenId /// <summary> /// 获取微信支付的OpenId /// </summary> /// < ...

  9. java对象的内存分配

    (1) 寄存器(register).这是最快的保存区域,这是主要由于它位于处理器内部.然而,寄存器的数量十分有限,所以寄存器是需要由编译器分配的.我们对此没有直接的控制权,也不可能在自己的程序里找到寄 ...

  10. QLCDNumber设置背景色和显示数字颜色

          只看楼主 倒序阅读楼主  发表于: 2013-10-22          //LCD时间显示    QLCDNumber *m_pLcdTime = new QLCDNumber(thi ...