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): 是一种编译时发生的错误,造成二义性调用的原因时在函数匹配时两个或多个函数提供的匹配一样好,编译器找不到唯一的最佳匹配. 实 ...
随机推荐
- [转载]memcached stats 命令
STAT pid 1552 STAT uptime 3792 STAT time 1262517674 STAT version 1.2.6 STAT pointer_size 32 STAT cur ...
- Easyui获取数据库date数据的显示
众所周知Oracle数据库中的date与众不同,在Easyui中显示数据库的date类型如果不经过转化为显示为Object.因此需要经过处理. 1.首先你要写转化date的JavaScript < ...
- JS-事件处理
1.一个简单的单击事件: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> ...
- 简单CSS定位瀑布流实现方法
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- ORACLE_CLASS_ENDING
[JSU]LJDragon's Oracle course notes In the first semester, junior year Oracle考前复习 试题结构分析: 1.选择题2x10, ...
- 一种调用opencv库的C++工程通用的Makefile模板
第一次自己写makefile,记录一下 #Compilers #CXX=/opt/compiler/gcc-/bin/g++ CXX = g++ #Includes INCLUDE_FLAGS = - ...
- Wi-Fi漫游的工作原理
Wi-Fi网络的一个极其重要的特点就是移动性.例如,一个人可以在使用Wi-Fi电话进行通话或是从服务器上下载大数据量的文件时穿过一幢建筑物.用户设备内部的Wi-Fi无线电可以从一个接入点漫游至另一个接 ...
- hadoop部署工具与配置工具
https://github.com/xianglei/phpHiveAdmin 随着Hadoop的推出,大数据处理实现了技术上的落地.但是对于一般的公司和开发者而言,Hadoop依旧是一个陌生或者难 ...
- Gradle的简介、安装与配置
Gradle介绍 Gradle是一个基于JVM的构建工具,它提供了: 像Ant一样,通用灵活的构建工具,对Ant的任务做了很好的集成 同Maven一样是基于约定的构建框架 强大的多工程构建支持.有广泛 ...
- 深入理解PreparedStatement和Statement
执行SQL语句时,就执行一次使用Statement对象,当一句SQL语句要执行多次,这时使用PrepareStatement.虽然使用PrepareStatement执行一次时非内存,但是,在后来的执 ...