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. [LeetCode] 147. Insertion Sort List 解题思路

    Sort a linked list using insertion sort. 问题:实现单向链表的插入排序. 这是比较常规的一个算法题目. 从左往右扫列表,每次将指针的下一个元素插入前面已排好序的 ...

  2. SQL-Employees Earning More Than Their Managers

    思路: 今天复习数据库突然想起来leetcode上数据库的题目,就找来做了 (1)给表取别名 格式见code,这在自身连接的时候是很有必要的 (2)自身连接 from语句后面相当于接了“一张表”,如果 ...

  3. typedef与define的区别

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

  4. Google Code Jam 2012 round 2 problem A: Swinging Wild

    题目连接 题意:你要从起点经过绳子荡到终点,每次你必须抓住另一个绳子,在空中不能向下爬.问是否有合理的方案 做法: 直接模拟 #include <iostream> #include &l ...

  5. sicily 4379 bicoloring

    题意:输入一个简单(无多重边和自环)的连通无向图,判断该图是否能用黑白两种颜色对顶点染色,使得每条边的两个端点为不同颜色. 解法:由于无自连通节点存在,所以只需进行一次宽搜,遍历所有的点和所有的边,判 ...

  6. 从 Windows 到 Android: 威胁的持续迁移

    作者:趋势科技 新闻媒体现在正喧腾着 OBAD 这个 Android 恶意软件,这也是到目前为止,Android 恶意软件中“最坏”,同时也是“最先进的 Android 木马程序”.除了各种强大的功能 ...

  7. 【转】Linux中安装Resin

      安装步骤: Ø  安装resin前先要保证安装了JDK,可以用命令查看是否安装了JDK: [root@wxr webapps]# java -versions java version " ...

  8. java中不常见的keyword:strictfp,transient

    1.strictfp, 即 strict float point (精确浮点). strictfp keyword可应用于类.接口或方法.使用 strictfp keyword声明一个方法时,该方法中 ...

  9. c# WPF 项目优化

    业务流程图 优化前后对比: 优化过程: 1. 界面刷新,特别是表格刷新 把ListView.DataContext  = DataSet 这些代码替换成以下: public static void S ...

  10. Mac下Qt连接MySQL 驱动问题

    Mac OS X下Qt的mySQL driver编译安装 原创文章,采用CC协议发布,转载请注明: 转载自canX.me 本文链接地址: Mac OS X下Qt的mySQL driver编译安装 – ...