1、 递归算法:quicksort.cpp#include using namespace
std;void Swap(int a[],int i,int j){ int temp=a[i]; a[i] = a[j]; a[j] = temp;}int
Partition(int a[],int l...
分类:
其他好文 时间:
2014-05-27 02:29:55
阅读次数:
274
【面试题030】最小的k个数题目: 输入n个整数,找出其中最小的k个数。
例如输入4、5、1、6、2、7、3、8这8个字,则其中最小的4个数字是1、2、3、4。思路一:
可以同样的基于随机快速排序的Partition函数,来对数组做划分, 基于k来作调整,返回调用Partition函数,直到...
分类:
其他好文 时间:
2014-05-27 02:04:02
阅读次数:
287
1.三种控制流语句:if\for\while2.每句后都要加冒号3.有elif语句=else后加一个if注意使用变量名!注意缩进!注意控制流语句后面要加冒号!4.for
i in range(0,5)5.break6.continue=================================...
分类:
编程语言 时间:
2014-05-27 01:01:56
阅读次数:
294
Given a linked list and a valuex, partition it
such that all nodes less thanxcome before nodes greater than or equal tox.You
should preserve the origi...
分类:
其他好文 时间:
2014-05-24 04:59:06
阅读次数:
275
乱搞分区磁盘什么的导致开机和这位仁兄一样:http://zhidao.baidu.com/question/495602654256708364.html?ssid=0&from=1001874a&uid=0&pu=usm%401%2Csz%401320_1002&bd_page_type=1&ba...
题目:Given an integer, convert it to a roman numeral.
Input is guaranteed to be within the range from 1 to 3999.
罗马表示方式如下:
I = 1;
V = 5;
X = 10;
L = 50;
C = 100;
D = 500;
M = 1000;
其中每...
分类:
其他好文 时间:
2014-05-22 13:00:09
阅读次数:
240
【题目】
Given a sorted array of integers, find the starting and ending position of a given target value.
Your algorithm's runtime complexity must be in the order of O(log n).
If the target is not found in the array, return [-1, -1].
For example,
Given [5...
分类:
其他好文 时间:
2014-05-22 06:44:39
阅读次数:
265
5道题目分别是:【Combinations】、【Search a 2D Matrix】、【Scramble String 】、【Rotate List 】、【Partition List】,由于有一些题目不需要发一整篇博文来记录,所以就将这些题目以一篇博文5道来记录。...
分类:
其他好文 时间:
2014-05-20 15:36:16
阅读次数:
293
1.
优化器(Optimizer)是sql分析和执行的优化工具,它负责制定sql的执行计划,负责保证sql执行效率最高,比如决定oracle以什么方式访问数据,全表扫描(full
table scan)还是索引范围(index range scan)扫描,还是全索引快速扫描(index fast f...
分类:
数据库 时间:
2014-05-19 15:36:12
阅读次数:
445
【题目】
Given a roman numeral, convert it to an integer.
Input is guaranteed to be within the range from 1 to 3999.
【题意】
把罗马数转换为整数
【思路】
罗马数字中只使用如下七个基值字母:M,D,C,L,X,V,I,分别用来表示1000、500、100、50、10、5、1。
大体思路是每个罗马字母对应的值相加即可,
但需要处理900, 400, 90, 40, 9, 4这几个特殊...
分类:
其他好文 时间:
2014-05-18 07:58:54
阅读次数:
293