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. chrome浏览器测试js函数

    1.直接在console中写入代码 2.既要写函数,又要写执行函数的代码. 不关闭网页,函数能够在内存中存活很久 浏览器都能记住函数. 当然,在其他页面无效.

  2. HDU 3262 Seat taking up is tough (模拟搜索)

    传送门:http://acm.hdu.edu.cn/showproblem.php?pid=3262 题意:教室有n*m个座位,每个座位有一个舒适值,有K个学生在不同时间段进来,要占t个座位,必须是连 ...

  3. SQL - 配置SQLServer 使其可以远程访问

    环境: SQL Server2008 R2 SQL Server Management Studio 今天测试部署项目的时候,发现不能远程访问SQL Server.具体情形就是在Management ...

  4. TTTAttributedLabel使用介绍(转)

    TTTAttributedLabel 库地址 https://github.com/TTTAttributedLabel/TTTAttributedLabel 可以实现电话  地址  链接自动查找显示 ...

  5. ionic学习教程地址梳理

    Ionic是一个新的.可以使用HTML5构建混合移动应用的用户界面框架,它自称为是"本地与HTML5的结合".该框架提供了很多基本的移动用户界面范例,例如像列表(lists).标签 ...

  6. 获取WebView加载HTML时网页中的内容

    main.xml如下: [html] view plaincopy <RelativeLayout xmlns:android="http://schemas.android.com/ ...

  7. C#运行时鼠标移动控件 - 调用Windows API(ReleaseCapture)

    [System.Runtime.InteropServices.DllImport("user32.dll")] public static extern bool SendMes ...

  8. DS18B20

    DS18B20驱动 [ 2012-5-14 12:01:00 | By: 吴师傅 ]   14 推荐 一.概述 DS18B20是一种单总线数字温度传感器.測试温度范围-55℃-125℃,温度数据位可配 ...

  9. 跟我一起学extjs5(22--模块Form的自己定义的设计)

    跟我一起学extjs5(22--模块Form的自己定义的设计)         前面几节完毕了模块Grid的自己定义,模块Form自己定义的过程和Grid的过程类似,可是要更复杂一些.先来设计一下要完 ...

  10. Gcc简介与常用命令

    一.对于GUN编译器来说,程序的编译要经历预处理.编译.汇编.连接四个阶段,如下图所示: 在预处理阶段,输入的是C语言的源文件,通常为*.c.它们通常带有.h之类头文件的包含文件.这个阶段主要处理源文 ...