- 博客(103)
- 资源 (2)
- 收藏
- 关注
原创 求数组的全排列
给定一个数组,求出全排列的情形? 算法描述: /** — 给定数组 3 4 6 9 8 7 5 2 1 如何求出紧挨着的下一个排列? step1:从后面扫描,找到第一个下降的数(6),并记录; step2:依然从后面扫描,找到第一个大于step1(6)的数7,并记录; step3:交换step1(6)、step2(7);=》3 4 7 9 8 6
2015-06-16 19:28:47 940
原创 面试题:最大的子数组之和,和最大子数组的始末位置
给出一个数组,求出最大子数组的和以及始末位置。 直接给出代码解释:int sub_array(int *array,int n){ int max2 = -INF; int sum = 0; int cur = 0; int count2 = 0; int flag; int _end; /*时间复杂度:o(n) 空间复杂度:o(1) */
2015-06-16 19:17:52 1023
原创 **360 笔试 登山者行走步数
360 笔试 登山者的步数 分析代码如下:#include <iostream>#include <cstdlib>#include <cstdio>#include <algorithm>#include <cstring>using namespace std;const int n = 100;typedef struct Mountains{ int begin;
2015-05-14 12:08:12 744
原创 codeblocks 多线程 pthread_create 函数未定义引用 解决办法
codeblocks 多线程 pthread_create 函数未定义引用 解决办法
2015-04-29 10:13:21 2619 2
原创 KMP 算法
#include #include #include using namespace std;const int MAX = 100;int nextVal[MAX];void get_next(char t[]){ int len = strlen(t); int i=1; int j=0; nextVal[1]=0; while(i < l
2015-03-30 19:59:21 678
原创 面试题(三)二维数组中的查找
题目描述:在一个二维数组中,每一行都是从左到右递增的,每一列都是从上到下递增的,完成一个函数,输入一个数组和一个整数,判断这个整数是否在数组中。1 2 8 9 2 4 9 12 4 7 10 13 6 8 11 15 根据数组的特点 由于数组每行每列都有个递增的顺序,所以考虑判断起始点的问题 若果把初始点选为1(15)比较,若待查找的数值比1大,1会往右
2014-12-31 07:53:44 664
原创 浅谈PageRank算法
PageRank,网页排名,又称网页级别、Google左侧排名或佩奇排名,是一种由搜索引擎根据网页之间相互的超链接计算的技术,而作为网页排名的要素之一。
2014-12-22 15:21:11 690
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人