CCI_chapter 8 Recurision
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的更多相关文章
- CCI_chapter 19 Moderate
19 1 Write a function to swap a number in place without temporary variables void swap(int &a, i ...
- 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 ...
- CCI_chapter 13C++
13.9Write a smart pointer (smart_ptr) class template<class T>class SmartPoint{ public: SmartPo ...
- 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 ...
- 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, ...
- CCI_chapter 2 Linked Lists
2.1 Write code to remove duplicates from an unsorted linked list /* Link list node */ struct node { ...
- CCI_chapter 1
1.1Implement an algorithm to determine if a string has all unique characters What if you can not us ...
- Linux系统下搭建DNS服务器——DNS原理总结
2017-01-07 整理 DNS原理 域名到IP地址的解析过程 IP地址到域名的反向域名解析过程 抓包分析DNS报文和具体解析过程 DNS服务器搭建和配置 这个东东也是今年博主参见校招的时候被很多公 ...
- <<C++ Primer>> 第 6 章 函数
术语表 第 6 章 函数 二义性调用(ambiguous call): 是一种编译时发生的错误,造成二义性调用的原因时在函数匹配时两个或多个函数提供的匹配一样好,编译器找不到唯一的最佳匹配. 实 ...
随机推荐
- BZOJ3390: [Usaco2004 Dec]Bad Cowtractors牛的报复
3390: [Usaco2004 Dec]Bad Cowtractors牛的报复 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 43 Solved: ...
- HDOJ(HDU) 1673 Optimal Parking
Problem Description When shopping on Long Street, Michael usually parks his car at some random locat ...
- Remote Desktop Connection Manager 多个远程管理
http://www.microsoft.com/en-us/download/details.aspx?id=21101 Remote Desktop Connection Manager 多个远程 ...
- html+css显示代码书写版式
由于要显示行数,所以需选用html的列表标签ol,以下代码可以显示代码书写版式的效果: <style> .code-part { background: yellow; } .code-p ...
- DLL模块例2:使用__declspec(dllexport)导出函数,extern "C"规范修饰名称,隐式连接调用dll中函数
以下内容,我看了多篇文章,整合在一起,写的一个例子,关于dll工程的创建,请参考博客里另一篇文章:http://www.cnblogs.com/pingge/articles/3153571.html ...
- Day01_UNIX基础及VI简介
2013年09月29日 星期日 11时35分58秒 Linux 是一个区别于Windows的操作系统 Linux 是一个多用户的操作系统 Linux 系统通过账号区分不同的用户 在使用Linux系统的 ...
- mac os使用lsusb命令和连接未知的Android设备
今天在mac上连接一个android设备发现连不上,adb devices看不到设备.于是想用lsusb命令看下,结果发现Mac居然没有这个命令,于是网上搜了下.发现了以下的命令system_prof ...
- spring技术翻译开始
从今天开始,我会坚持每天花费两个小时来翻译一本英文书(当然自己觉得绝对算得上是经典),可能我英文水平有限,但也请路过的高人予以指点. 如果有翻译的出入很大,望各位告知,本人一定更改.决定翻译的目的有两 ...
- [SVG] Simple introduce for SVG
Just like create html page, you can create a svg tag by: <?xml version="1.0" encoding=& ...
- I/O输出端口照明LED
方案特点:I/O输出端口照明LED.而区间0.2秒闪烁!(非计时器延迟) (P1.0销被连接到LED) LED EQU P1.0 ;宏定义 ORG 0000H LJMP MAIN ORG 0200H ...