E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
!!!Interview
申明一个函数指针,并且该函数的返回值也是一个函数指针 -- 示例代码
来自
interview
的一个考题,所以写了一个测试程序来demonstrate一下。
·
2015-10-31 11:48
函数指针
[翻译].NET牛人应该知道些什么
原文地址:http://www.hanselman.com/blog/WhatGreatNETDevelopersOughtToKnowMoreNET
Interview
Questions.aspx 作者
·
2015-10-31 11:38
.net
[Reading]Jackson's sister breaks silence
In her first
interview
following Michael Jackson's sudden death in June, Janet Jackson has said that
·
2015-10-31 11:40
Jackson
[英文面試]如何寫面試後的感謝信
X:尊敬的X先生: Thank you very much for the
interview
yesterday.
·
2015-10-31 11:42
架构相关
伏威谈淘宝网的高并发处理与压力测试 http://www.infoq.com/cn/
interview
s/fw-taobao-concurrency-stress-testing 2.
·
2015-10-31 11:03
架构
C#面试基础问题
English Version: http://dflying.dflying.net/1/archive/104_c_basic_
interview
_questions.html 如果你的简历上面写
·
2015-10-31 11:27
C#
[转].NET牛人应该知道些什么
原文地址:http://www.hanselman.com/blog/WhatGreatNETDevelopersOughtToKnowMoreNET
Interview
Questions.aspx 作者
·
2015-10-31 10:13
.net
程序员面试题并附答案
Need to prepare for a job
interview
?
·
2015-10-31 10:58
程序员
115 Java
Interview
Questions and Answers – The ULTIMATE List--reference
In this tutorial we will discuss about different types of questions that can be used in a Java
interview
·
2015-10-31 10:59
reference
Ruby正则表达式实践非贪婪量词
直到遇到第一个" 另外是找到匹配的组,如下x[0] require 'open-uri' open('http://railslab.newrelic.com/category/masters-
interview
s
·
2015-10-31 10:31
正则表达式
Interview
English(series1)
Q: Can you sell yourself in two minutes? Go for it. (你能在两分钟內自我推荐吗?大胆试试吧!) A: With my qualifications and experience, I feel I am hardworking, responsible and diligent in any project I undertake. You
·
2015-10-31 10:25
interview
[Resume]:
Interview
Series1
1、Do you prefer working by yourself or with others? Both! Sometimes i have an assignment that needs total concentration, like coding. At times like these, i need to be alone and be quiet. But,
·
2015-10-31 10:25
interview
更好地领导一个项目的诀窍
以下是我11年来作为
Interview
ing Manager的Team管理体会,
·
2015-10-31 10:50
项目
What makes a good front end engineer?
I was doing an
interview
yesterday here at Yahoo!
·
2015-10-31 10:43
Engine
《Cracking the Coding
Interview
》——第18章:难题——题目4
2014-04-29 01:05 题目:数数从0到n总共有多少个数字‘2’? 解法:数位动态规划,可以O(log10(n))时间内解决。 代码: 1 // 18.4 Count the number of 2s from 0 to n. 2 #include <iostream> 3 using namespace std; 4 5 int main()
·
2015-10-31 10:11
interview
《Cracking the Coding
Interview
》——第17章:普通题——题目14
2014-04-29 00:20 题目:给定一个长字符串,和一个词典。如果允许你将长串分割成若干个片段,可能会存在某些片段在词典里查不到,有些则查得到。请设计算法进行分词,使得查不到的片段个数最少。 解法:用空间换取时间的动态规划算法,首先用O(n^2)的时间判断每一个片段是否在字典里。这个过程其实可以通过字典树来进行加速,时间上能优化一个阶,不过我没写,偷懒用<unordered_se
·
2015-10-31 10:11
interview
《Cracking the Coding
Interview
》——第18章:难题——题目2
2014-04-29 00:59 题目:设计一个洗牌算法,效率尽量快点,必须等概率。 解法:每次随机抽一张牌出来,最后都抽完了,也就洗好了。时间复杂度O(n^2),请看代码。 代码: 1 // 18.2 shuffle a deck of 52 cards, it must be perfect random. 2 #include <cstdio> 3 #incl
·
2015-10-31 10:11
interview
《Cracking the Coding
Interview
》——第18章:难题——题目1
2014-04-29 00:56 题目:不用算数运算,完成加法。 解法:那就位运算吧,用加法器的做法就可以了。 代码: 1 // 18.1 add two numbers wihout using arithmetic operator. 2 #include <iostream> 3 using namespace std; 4 5 int add(in
·
2015-10-31 10:11
interview
《Cracking the Coding
Interview
》——第18章:难题——题目3
2014-04-29 01:02 题目:从m个整数里随机选出n个整数,要求等概率。 解法:和洗牌的算法类似,每次随机抽出一个数,抽n次即可。时间复杂度O(m * n),空间复杂度O(m)。 代码: 1 // 18.3 pick m integers randomly from an array of n integer. 2 #include <cstdio> 3
·
2015-10-31 10:11
interview
《Cracking the Coding
Interview
》——第17章:普通题——题目8
2014-04-28 23:35 题目:最大子数组和问题。 解法:O(n)解法。 代码: 1 // 17.8 Find the consecutive subarray with maximum sum in an array. 2 // O(n) online algorithm. 3 #include <cstdio> 4 #include <vect
·
2015-10-31 10:10
interview
《Cracking the Coding
Interview
》——第17章:普通题——题目4
2014-04-28 22:32 题目:不用if语句或者比较运算符的情况下,实现max函数,返回两个数中更大的一个。 解法:每当碰见这种无聊的“不用XXX,给我XXX”型的题目,我都默认处理的是int类型。最高位是符号位,用x - y的符号位来判断谁大谁小。请看下面代码,条件表达式配合异或运算能满足题目的要求。 代码: 1 // 17.4 Find the maximum of two
·
2015-10-31 10:10
interview
《Cracking the Coding
Interview
》——第17章:普通题——题目9
2014-04-28 23:52 题目:设计算法,找出一本书中某个单词的出现频率。 解法:数就行了。 代码: 1 // 17.9 Given a book, find out the occurrences of any given words in it. 2 // Answer: 3 // 1. process the book as a text file. 4
·
2015-10-31 10:10
interview
《Cracking the Coding
Interview
》——第17章:普通题——题目5
2014-04-28 22:44 题目:猜数字游戏。四个数字,每个都是0~9之间。你每猜一次,我都告诉你,有多少个位置和数字都对(全对),有多少个位置错数字对(半对)。比如“6309”,你猜“3701”,就有1全对,1半对。 解法:依照题意写就可以了。 代码: 1 // 17.5 I am the Master Mind. Guess the number. 2 // When y
·
2015-10-31 10:10
interview
《Cracking the Coding
Interview
》——第17章:普通题——题目6
2014-04-28 22:49 题目:给定一个整数数组。如果你将其中一个子数组排序,那么整个数组都变得有序。找出所有这样子数组里最短的一个。 解法:线性时间,常数空间内可以解决,思想类似于动态规划。通过正反扫描两次,可以得出这个区间的两端。只要存在i < j并且a[i] > a[j],那么这个区间[i, j]就必须被排序,为了在线性时间内完成算法,我们可以通过不断比较当前元素与当
·
2015-10-31 10:10
interview
《Cracking the Coding
Interview
》——第17章:普通题——题目7
2014-04-28 23:28 题目:给定一个数字,用英语把它读出来。 解法:ZOJ上有相反的题目。如果我要用中文读书来呢? 代码: 1 // 17.7 Read an integer in English. 2 #include <map> 3 #include <string> 4 using namespace std; 5
·
2015-10-31 10:10
interview
《Cracking the Coding
Interview
》——第17章:普通题——题目11
2014-04-29 00:00 题目:给定一个rand5()函数,能够返回0~4间的随机整数。要求实现rand7(),返回0~6之间的随机整数。该函数产生随机数必须概率相等。 解法:自己想了半天没想出等概率的方法,最后参考答案了。答案思想实在巧妙:随机0~24间的数,然后把21~24丢弃,剩余的0~20对7取模就是等概率随机数了。 代码: 1 // 17.11 Given a ran
·
2015-10-31 10:10
interview
《Cracking the Coding
Interview
》——第17章:普通题——题目12
2014-04-29 00:04 题目:给定一个整数数组,找出所有加起来为指定和的数对。 解法1:可以用哈希表保存数组元素,做到O(n)时间的算法。 代码: 1 // 17.12 Given an array of integers and target value, find all pairs in the array that sum up to the target. 2
·
2015-10-31 10:10
interview
《Cracking the Coding
Interview
》——第17章:普通题——题目10
2014-04-28 23:54 题目:XML文件的冗余度很大,主要在于尖括号里的字段名。按照书上给定的方式进行压缩。 解法:这题我居然忘做了,只写了一句话的注解。用python能够相对方便地实现,因为有直接的XML工具可以调用。书上的那种要求应该是符合前序遍历规则。 代码: 1 # 17.10 Parse an XML file, and try to save some space
·
2015-10-31 10:10
interview
《Cracking the Coding
Interview
》——第17章:普通题——题目13
2014-04-29 00:15 题目:将二叉搜索树展开成一个双向链表,要求这个链表仍是有序的,而且不能另外分配对象,就地完成。 解法:Leetcode上也有,递归解法。 代码: 1 // 17.13 Flatten a binary search tree into a doubly linked list by inorder traversal order. 2 // Use
·
2015-10-31 10:10
interview
《Cracking the Coding
Interview
》——第16章:线程与锁——题目1
2014-04-27 19:09 题目:线程和进程有什么区别? 解法:理论题,操作系统教材上应该有很详细的解释。我回忆了一下,写了如下几点。 代码: 1 // 16.1 What is the difference between process and thread? 2 Answer: 3 Process: 4 1. Basic element
·
2015-10-31 10:09
interview
《Cracking the Coding
Interview
》——第16章:线程与锁——题目3
2014-04-27 19:26 题目:哲学家吃饭问题,死锁问题经典模型(专门用来黑哲学家的?)。 解法:死锁四条件:1. 资源互斥。2. 请求保持。3. 非抢占。4. 循环等待。所以,某砖家拿起一只筷子后如果发现没有另一只了,就必须把手里这只筷子放下,这应该是通过破坏“请求保持”原则来防止死锁产生,请求资源失败时,连自己的资源也进一步释放,然后在下一轮里继续请求,直到成功执行。 代码:
·
2015-10-31 10:09
interview
《Cracking the Coding
Interview
》——第16章:线程与锁——题目4
2014-04-27 20:06 题目:设计一个类,只有在不产生死锁的时候才分配资源。 解法:不太清楚这个题是要分配何种资源,以何种形式?所以没能动手写个可运行的代码,只是闲扯了几句理论分析。 代码: 1 // 16.4 Design a class which provides a lock only if no deadlock would take place. 2 1. T
·
2015-10-31 10:09
interview
《Cracking the Coding
Interview
》——第16章:线程与锁——题目2
2014-04-27 19:14 题目:如何测量上下文切换的时间? 解法:首先,上下文切换是什么,一搜就知道。对于这么一个极短的时间,要测量的话,可以通过放大N倍的方法。比如:有A和B两件事,并且经常一起发生,每件只需要花几纳秒。如果你把A事件连续做几百万次,而B时间只做了几次,这样就能排除B事件对于测量的影响。如果总时间S = mA + nB。当m >> n 时,A≈S / m。
·
2015-10-31 10:09
interview
《Cracking the Coding
Interview
》——第16章:线程与锁——题目5
2014-04-27 20:16 题目:假设一个类Foo有三个公有的成员方法first()、second()、third()。请用锁的方法来控制调用行为,使得他们的执行循序总是遵从first、second、third的顺序。 解法:你应该想到了用lock的方法类阻塞,不过这里面有个概念问题使得直接用ReentrantLock不能通过编译(对于一个锁对象,不同在A线程中锁定,又在B线程中解锁,不
·
2015-10-31 10:09
interview
《Cracking the Coding
Interview
》——第16章:线程与锁——题目6
2014-04-27 20:25 题目:关于java中标有synchronized的成员方法? 解法:这代表同一个对象实例的synchronized方法不能被多个线程同时调用。注意有这么多个地方都加粗了,如果这些条件有一个不满足的话,就是可以调用的。另外,如果此方法是静态成员方法, 那么总可以认为是“同一实例”的,因为静态方法就属于一个类,类似于单体。 代码: 1 // 16.6 Ho
·
2015-10-31 10:09
interview
《Cracking the Coding
Interview
》——第17章:普通题——题目2
2014-04-28 22:05 题目:写个程序判断三连棋哪一方赢了。 解法:三个相同的棋子连成一条横线,竖线或者对角线就判断为赢了。 代码: 1 // 17.2 Write an algorithm to check if someone has won the tic-tac-toe game. 2 // Here is the game: 3 // xo- 4
·
2015-10-31 10:09
interview
《Cracking the Coding
Interview
》——第17章:普通题——题目3
2014-04-28 22:18 题目:计算N的阶乘尾巴上有多少个零? 解法:计算5的个数即可,因为2 * 5 = 10,2的个数肯定比5多。计算5的个数可以在对数时间内搞定。 代码: 1 // 17.3 Count how many zeros are there in n!? 2 // Count the number of 5s in n!. 3 #include <
·
2015-10-31 10:09
interview
《Cracking the Coding
Interview
》——第17章:普通题——题目1
2014-04-28 21:45 题目:就地交换两个数,不使用额外的变量。 解法:没说是整数,我姑且先当整数处理吧。就地交换可以用加法、乘法、异或完成,其中乘法和加法都存在溢出问题。三种方法都不能处理交换同一个数的情况,需要条件判断。 代码: 1 // 17.1 Do a swapping in-place. 2 #include <cstdio> 3 using
·
2015-10-31 10:09
interview
《Cracking the Coding
Interview
》——第13章:C和C++——题目8
2014-04-25 20:27 题目:实现一个能够通过引用计数来实现自动回收数据的智能指针,用C++,不是java。 解法:这题真心牛,我的第一反应是发呆,因为对引用计数的了解仅限于这个名词,完全没办法建立模型。之后仔细把题解读了两遍之后,照样敲了一遍代码。然后边调试边阅读才有了些理解。引用计数有四点需要注意:1. 引用计数是个非负整数。2. 引用计数是对于一个实体变量的,所有指向这个实体的
·
2015-10-31 10:08
interview
《Cracking the Coding
Interview
》——第14章:Java——题目3
2014-04-26 18:59 题目:final、finally、finalize有什么区别? 解法:烂大街之java语法题。此题被多少公司考过我不知道,反正我确实遇见过一次了。 代码: 1 // 14.3 final, finally and finalize, what are they? 2 // you can't inherit me 3 public final
·
2015-10-31 10:08
interview
《Cracking the Coding
Interview
》——第14章:Java——题目2
2014-04-26 18:44 题目:在java的try-catch-finally语句块里,如果catch里面有return语句的话,finally还会被执行吗? 解法:会。 代码: 1 // 14.2 Will the code in finally {} be executed if there is a return statement inside try {} or ca
·
2015-10-31 10:08
interview
《Cracking the Coding
Interview
》——第14章:Java——题目1
2014-04-26 18:20 题目:从继承的角度,把构造函数设成private有什么意义? 解法:就不能继承了。单体模式里也这么干,目的是为了不让使用者自主生成对象,进行限制。 代码: 1 // 14.1 In terms of inheritance, what is the point of declaring the constructor as private? 2 /
·
2015-10-31 10:08
interview
《Cracking the Coding
Interview
》——第13章:C和C++——题目10
2014-04-25 20:47 题目:分配一个二维数组,尽量减少malloc和free的使用次数,要求能用a[i][j]的方式访问数据。 解法:有篇文章讲了六种new delete二维数组的方式,其中最后一种灰常高效。链接在此,解法六是巧妙的,不过里面的说法不对,而且还不标明转载原地址,可见这些技术网站的小编既不懂编程,也不尊重知识产权。没准这篇文章已经转载了无数次了。用这种方法创建和释放一
·
2015-10-31 10:08
interview
《Cracking the Coding
Interview
》——第13章:C和C++——题目9
2014-04-25 20:37 题目:请设计一个字节对齐的malloc函数,配套上对应的free函数。要求这个函数分配出的内存块儿的首地址是某个值n的整数倍,n是2的整次幂,比如128、1024之类的。 解法:默认的malloc分配的首地址是不确定的,所以我们需要多分配一些内存,才能保证其中至少有一个字节能满足上述的要求,作为首地址。多余的地址不会被使用,但也要一起释放。每n个字节里,肯定有
·
2015-10-31 10:08
interview
《Cracking the Coding
Interview
》——第13章:C和C++——题目7
2014-04-25 20:18 题目:给定一个Node结构体,其中包含数据成员和两个Node*指针指向其他两个Node结构(还不如直接说这是个图呢)。给你一个Node指针作为参数,请做一份深拷贝作为结果返回。 解法:BFS搞定,需要检测重复节点以防止死循环,用一个哈希表可以做大。这样肯定只能找出一个完整的连通分量,其他连通分量的节点是无法检测到的。下面的代码其实是我在做leetcode时写的
·
2015-10-31 10:08
interview
《Cracking the Coding
Interview
》——第14章:Java——题目6
2014-04-26 19:11 题目:设计一个循环数组,使其支持高效率的循环移位。并能够使用foreach的方式访问。 解法:foreach不太清楚,循环移位我倒是实现了一个,用带有偏移量的数组实现。修改元素不一定能做到O(1)时间,但循环移位能在O(1)时间解决。不得不说,用不熟的语言写面试题,很难~~~ 代码: 1 // 14.6 Implement a circular arr
·
2015-10-31 10:08
interview
《Cracking the Coding
Interview
》——第14章:Java——题目5
2014-04-26 19:06 题目:Java中的对象反射机制是什么?有鼠么用? 解法:完全不了解,因为java编程经验太少,完全没用过。查了一些资料后,感觉反射机制是个强大并需要边用边体会的强大工具。能灵活处理各种动态类型下的问题。 代码: 1 // 14.5 Tell me something about Object Reflection in java. 2 // Ans
·
2015-10-31 10:08
interview
《Cracking the Coding
Interview
》——第14章:Java——题目4
2014-04-26 19:02 题目:解释下C++里模板和java里泛型的区别? 解法:我很少用java,属于连语法都不过关的程度。所以这个题还真没法详细答,查了些资料以后写了以下几点。 代码: 1 // 14.4 tell me about the differences between C++ template and java generics. 2 // Answer:
·
2015-10-31 10:08
interview
《Cracking the Coding
Interview
》——第13章:C和C++——题目6
2014-04-25 20:07 题目:为什么基类的析构函数必须声明为虚函数? 解法:不是必须,而是应该,这是种规范。对于基类中执行的一些动态资源分配,如果基类的析构函数不是虚函数,那么 派生类的析构函数在自动调用的时候,不会调用基类的析构函数,这样就会造成资源未释放引起的内存泄漏。 代码: 1 // 13.6 If a class is defined as base class,
·
2015-10-31 10:07
interview
《Cracking the Coding
Interview
》——第13章:C和C++——题目3
2014-04-25 19:42 题目:C++中虚函数的工作原理? 解法:虚函数表?细节呢?要是懂汇编我就能钻的再深点了。我试着写了点测大小、打印指针地址之类的代码,能起点管中窥豹的作用,从编译器的外部感受下虚函数表、虚函数指针的存在。 代码: 1 // 13.3 How does virtual function works in C++? 2 #include <cstr
·
2015-10-31 10:07
interview
上一页
80
81
82
83
84
85
86
87
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他