- 博客(35)
- 资源 (11)
- 收藏
- 关注
原创 打印括号的合法组合
From career up 150.Implement an algorithm to print all valid (e.g., properly opened and closed) combinations of n-pairs of parentheses.#include using namespace std;const int n = 3;char a[n * 2
2012-07-31 10:50:26 846
原创 基本数据结构/算法题总结
1. 字符串相关a. 一组字符串,判断at least one is a prefix of another?b. reverse a stringc. reverse words in a stringd. atoi()e. 求一个字符串最长回文2. 数组相关a. 2n+2个数,求2个不同的b. 一个数组,删除重复整数c. 一个数组,求出所有和为定值的
2012-07-29 16:58:00 687
原创 设计题总结
1. Provide a object oriented design for expression evaluator2. Hotel reservation system3. Design file system4. Design database tables for books, authors, publishers.5. Design parking lot.
2012-07-29 15:54:22 1030
转载 ACM--楼层扔鸡蛋问题
From: http://blog.163.com/ty_sky0908/blog/static/133360335201101155853282/ACM--楼层扔鸡蛋问题 IMNU OJ 1253--鸡蛋DescriptionGardon有一些鸡蛋,他现在想知道这些鸡蛋的硬度。Gardon的家住在一座很高很高的大楼里,他现在要在这座大楼上测试鸡蛋的硬度。每个鸡蛋的硬度相同,
2012-07-29 13:55:25 3018
原创 Bit Manipulation
From: career up 150.1. Question:Given an integer, print the next smallest and next largest number that have the same number of 1 bits in their binary representation.Answer:Number Properties
2012-07-28 16:20:15 950
原创 Shuffle an Array or a List - Algorithm in Java
From: http://www.vogella.com/articles/JavaAlgorithmsShuffle/article.htmlThis article describes how to shuffle the content of an array or a list in Java. After the shuffle the elements in the array o
2012-07-25 22:18:19 1742
转载 floodfill算法
From: http://hi.baidu.com/qteqpid_pku/blog/item/fcb366eeeb0d182f2cf53464.html+ From wikipediaFlood fill, also called seed fill, is an algorithm that determines the area connected to a give
2012-07-25 22:14:19 7653 1
原创 打印螺旋矩阵
see: http://www.geeksforgeeks.org/archives/10768Print a given matrix in spiral formAugust 20, 2011Given a 2D array, print it in spiral form. See the following examples.Input:
2012-07-25 21:57:20 687
原创 二叉树题总结
1. LCA (lowest common ancestor)1) Tarjan算法,参考http://hi.baidu.com/luyade1987/blog/item/5b609b016fcecbd3277fb5ac.html#include using namespace std;const int N = 10001;int id[N], lcs[N][N], g[N
2012-07-25 21:53:25 739
转载 如何设计一个LRU Cache
From: http://blog.csdn.net/hexinuaa/article/details/6630384如何设计一个LRU Cache?通常的问题描述可以是这样:Question:[1] Design a layer in front of a system which cache the last n requests and the responses t
2012-07-25 21:48:35 616
原创 快速寻找满足条件的两个数
1. Question:Given a listed list and an integer, find two numbers in the list that sum to the given number.能否快速找出一个数组中的两个数字,让这个两个数字之和等于一个给定的值,为了简化起见,我们假设这个数组中肯定至少存在一组满足要求的解。2. Answer:先对数组进行排序
2012-07-25 20:45:47 594
原创 Nick's Quant Interview Questions
这里有一些很不错的概率/逻辑题 http://excelexperts.com/Quant-Interview-Questions例如:“You are given 3 chances to drop a non-biased dice (with number from 1-6). You can stop earlier, but the number of final drop is t
2012-07-24 22:08:17 1085
原创 链表中随机取出k个数 - 蓄水池抽样
1. From: http://stackoverflow.com/questions/48087/select-a-random-n-elements-from-listt-in-c-sharp/48089#48089Question:I need a quick algorithm to select a random 5 elements from a generic list.
2012-07-24 20:52:32 2174
原创 二叉树中序遍历非递归
#include using namespace std;class Node{public: Node* left; Node* right; int data;};void inOrder(Node* r){ stack s; s.push(r);
2012-07-22 17:36:27 829
原创 二叉树判断子树问题
From career up 150,Question:You have two very large binary trees: T1, with millions of nodes, and T2, with hundreds of nodes. Create an algorithm to decide if T2 is a subtree of T1.Answer:1)
2012-07-22 17:25:36 2942 1
原创 二叉树寻找中序遍历的后继节点
From: http://www.careercup.com/question?id=13324669Question:There is a tree with additional field in each node, named "next". We have to put the inorder successor in this pointer.Answer:
2012-07-22 16:00:21 2155
原创 硬币找零问题
1. QuestionGiven a list of 'N' coins, their values being in an array A[], return the minimum number of coins required to sum to 'S' (you can use as many coins you want). If it's not possible to su
2012-07-22 13:27:03 1486
原创 Keep track of the median?
From: Career up 150.1. Question: Numbers are randomly generated and stored into an (expanding) array. How would you keep track of the median?Answer: Heap? A heap is really good at basic ordering
2012-07-21 15:46:26 1182
原创 C++: Pure Virtual Function Called
最近从水木C++版看到了这个问题,什么情况下纯虚函数会被调用?这个链接解释的比较清楚,http://www.artima.com/cppsource/pure_virtual.html下面是一个demo,在基类构造函数中调用纯虚函数,>> cat pure1.C #include using namespace std;class B {public:
2012-07-15 18:26:17 2666
转载 Apache Mahout 简介 通过可伸缩、商业友好的机器学习来构建智能应用程序
From: http://www.ibm.com/developerworks/cn/java/j-mahout/在信息时代,公司和个人的成功越来越依赖于迅速有效地将大量数据转化为可操作的信息。无论是每天处理数以千计的个人电子邮件消息,还是从海量博客文章中推测用户的意图,都需要使用一些工具来组织和增强数据。 这其中就蕴含着机器学习 领域以及本文章所介绍项目的前景:Apache
2012-07-09 21:31:03 1844
转载 网页去重
from: http://a280606790.iteye.com/blog/867878搜索引擎判断复制网页一般都基于这么一个思想:为每个网页计算出一组信息指纹(Fingerprint) ,若两个网页有一定数量相同的信息指纹,则认为这两个网页的内容重叠性很高,也就是说两个网页是内容复制的。很多搜索引擎判断内容复制的方法都不太一样,主要是以下两点的不同:1、计算信息指纹(Fin
2012-07-09 21:23:40 1332
原创 Linker error with Hadoop Pipes
see http://stackoverflow.com/questions/6051671/linker-error-with-hadoop-pipes在编译C++代码时,加上-lcrypto
2012-07-09 21:20:21 574
原创 《Hadoop The Definitive Guide》ch14 Case Studies
1. Hivehive是基于Hadoop的一个数据仓库工具,可以将结构化的数据文件映射为一张数据库表,并提供完整的sql查询功能,可以将sql语句转换为MapReduce任务进行运行。 其优点是学习成本低,可以通过类SQL语句快速实现简单的MapReduce统计,不必开发专门的MapReduce应用,十分适合数据仓库的统计分析。2. Nutch参考:http://blog.csdn
2012-07-08 21:56:39 651
原创 《Hadoop The Definitive Guide》ch13 ZooKeeper
1. 关于ZooKeeper的介绍,http://www.searchtb.com/2011/01/zookeeper-research.htmlzookeeper是一个开源分布式的服务,它提供了分布式协作、分布式同步、配置管理等功能。2. 安装和运行export ZOOKEEPER_INSTALL=/local/honghaos/zookeeper/zookeeper-3.4
2012-07-07 16:32:50 1423
原创 《Hadoop The Definitive Guide》ch12 HBase
1. 关于HBase的介绍,http://www.searchtb.com/2011/01/understanding-hbase.html 很不错。HBase – Hadoop Database,是一个高可靠性、高性能、面向列、可伸缩的分布式存储系统,利用HBase技术可在廉价PC Server上搭建起大规模结构化存储集群。HBase是Google Bigtable的开源实现,类似G
2012-07-07 16:32:29 1263 1
原创 《Hadoop The Definitive Guide》ch11 Pig
1. PigPig是一种用于探索大型数据集的脚本语言,专门用于数据的批处理。2. 安装和启动export HADOOP_INSTALL=/local/nomad2/hadoop/hadoop-0.20.203.0export PATH=$PATH:$HADOOP_INSTALL/binexport JAVA_HOME=/usr/lib/jvm/java-6-sun
2012-07-07 16:32:07 1113
原创 《Hadoop The Definitive Guide》ch10 Administering Hadoop
1. 集群基准测试程序c01s02h01ate1:nomad2 # hadoop jar /local/hadoop/hadoop-0.20.203.0/hadoop-test-0.20.203.0.jar An example program must be given as the first argument.Valid program names are: DFSCIOTest
2012-07-07 16:31:42 596
原创 《Hadoop The Definitive Guide》ch09 Setting Up a Hadoop Cluster
参考下面的文章配置了一个具有3个节点的集群。http://yymmiinngg.iteye.com/blog/706699http://linleran.iteye.com/blog/287993http://www.cnblogs.com/wayne1017/archive/2007/03/20/678724.html要注意的是,slave节点和master节点的配置
2012-07-07 16:31:05 621
原创 《Hadoop The Definitive Guide》ch08 MapReduce Features
1. 计数器1) 内置计数器2) 用户自定义Java计数器[ate: /local/nomad2/hadoop/tomwhite-hadoop-book-32dae01 ]>> hadoop jar ch08.jar MaxTemperatureWithCounters input/ncdc/all max-temp12/07/03 19:53:21 INFO mapred.Fil
2012-07-07 16:29:36 627
原创 《Hadoop The Definitive Guide》ch07 MapReduce Types and Formats
MapReduce的数据模型非常简单,它的Map和Reduce函数使用键值对进行输入和输出。本章将深入讨论MapReduce的数据模型,尤其是文本或者二进制类型的数据如何在MapReduce中使用。1. MapReduce的类型map和reduce函数遵循以下的形式:map: (K1, V1) -> list(K2, V2)reduce: (K2, list(V2)) -> lis
2012-07-07 16:14:53 465
原创 《Hadoop The Definitive Guide》ch06 How MapReduce Works
1. MapReduce的工作原理1) 客户端 提交MapReduce作业。2) jobtracker 协调作业的运行。 jobtracker是一个Java应用程序,它的主类是JobTracker。3) tasktracker 运行作业划分后的任务。tasktracker是一个Java应用程序,它的主类是TaskTracker。4) 分布式文件系统(一般为HDFS),用来在其他实体
2012-07-07 16:01:44 766
原创 《Hadoop The Definitive Guide》ch05 Developing a MapReduce Application
1. 介绍MapReduce应用开发包含特定的流程。首先,编写map和reduce函数,最好能进行单元测试以保证它们能如期运行。然后写一个驱动程序来运行作业,可以使用数据集中的少量数据从IDE运行,看它是否能够正常运行。2. GenericOptionsParser, Tool和ToolRunner[ate: /local/nomad2/hadoop/tomwhite-hadoop
2012-07-07 15:43:08 750
原创 《Hadoop The Definitive Guide》ch04 Hadoop I/O
1. Hadoop comes with a set of primitives for data I/O. Some of these are techniques that are more general than Hadoop, such as data integrity and compression, but deservespecial consideration when d
2012-07-07 14:45:31 1146
原创 《Hadoop The Definitive Guide》ch03 The Hadoop Distributed Filesystem
1. HDFS1.1 block1.2 namenode and datanode2. 命令行示例[ate: /local/nomad2/hadoop/tomwhite-hadoop-book-32dae01 ]>> hadoop fsck / -files -blocksFSCK started by nomad2 from /35.252.129.105 for
2012-07-07 14:42:33 611
原创 《Hadoop The Definitive Guide》ch02 MapReduce
1. MapReduce data flow with multiple reduce tasks2. Hadoop安装选择pseudo模式,配置文件如下,>> cat core-site.xml fs.default.name hdfs://localhost/
2012-07-07 14:41:37 1068
machine learning advice
2011-11-05
Inside Java Virtual Machine
2007-11-12
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人