- 博客(22)
- 问答 (1)
- 收藏
- 关注
原创 QT中开启了fakevim插件,并且选上了pass control key,导致vim自带的ctrl + o, ctrl +i 跳转快捷键无法使用。这怎么解决?
3)输入 ctlr+o和 ctrl+i, 过滤出这个快捷键。删除, 点击apply, 点击确定。总体思路: 删除QTCreator自带的快捷键, 因为和vim插件有冲突。
2025-03-20 09:14:28
368
原创 图求最短路径
class DeepTrace { public: void InitMap(const vector<vector<int> > vMap, const int &portNum) { m_map = vMap; m_portNum = portNum; m_traceTree.clear(); } bool GetRu
2015-09-17 18:06:43
529
原创 小算法:一个排名区间,对应一个奖品,给定一个排名区间,判断它要领取奖品的id
vector<int> m_vRankRegion; m_vRankRegion.push_back(1);//1 - 1 m_vRankRegion.push_back(1);//2 - 2 m_vRankRegion.push_back(1);//3 - 3 m_vRankRegion.push_back(1);//4 - 4 m_vRankRegion.push_back(1);//5 - 5
2015-09-07 20:16:05
554
原创 Viemu for 2008 如何高亮选中的单词?
Viemu for 2008 如何高亮选中的单词? 答:vim内置的命令gd,*,#, 但是会引起光标移动,怎么才能高亮选中的单词, 但又不移动光标呢。 步骤1:在windows下,建立C:/User/Adminstrator/_viemurc 步骤2:在_viemurc写入 步骤3::重启VS2008吧,然后光标选中单
2015-07-09 21:47:28
715
原创 两个队列模拟一个栈
思路就是两个队列切换来切换去。 个人代码如下: #include #include using namespace std; class CStack { public: void pop(); int top(); void push(int elem); void Move(queue &des, queue &sour, int begin, int end); CSta
2015-02-09 19:13:12
513
转载 AVL树的旋转操作 图解 最详细
转载地址: http://blog.youkuaiyun.com/collonn/article/details/20128205
2015-02-01 22:06:20
445
原创 二叉搜索树(二叉排序树)
开始个人树的学习: 二叉搜索树->平衡树AVL->红黑树 参考的博客地址://http://blog.chinaunix.net/uid-27033491-id-3301179.html 个人代码如下: //http://blog.chinaunix.net/uid-27033491-id-3301179.html #include using namespace std; //二叉搜索
2015-01-28 22:31:31
570
原创 设计模式之单例模式
个人代码如下: #include #include using namespace std; class CSingleton { private: static CSingleton* pObject; CSingleton(){pObject = NULL; strName = "im Singleton";} public: string strName; static CS
2015-01-26 23:37:28
543
原创 Abbott 的复仇(Abbott's Revenge,ACM|IPPC World Finals 2000, UVa 816)
代码如下: #include #include using namespace std; //const char * dirs = "NESW"; //const char * turns = "FLR"; const int N = 0, E = 1, S = 2, W = 3; const int F = 0, L = 1, R = 2; //分别表示N(上),E(右),S(下),
2015-01-25 15:37:40
2342
原创 链表反转
个人代码如下: #include using namespace std; typedef struct STNode { int data; struct STNode *next; }Node; void CreateList(Node *&Root, int len) { Node *pNewNode = NULL; for(int i = 0; i < len; ++i)
2015-01-21 23:07:51
510
原创 编写一个单词反转,字符不反转的函数。
如题:规则如下 输入:im a bad student 输出:student bad a im 方法1:不借助辅助的空间 #include #include using namespace std; void ReverseWord(char a[], int begin, int end) { for(; begin < end; ++begin, --end) swap(a
2015-01-17 20:24:46
643
原创 求第n个斐波那契数的值(递归和非递归解法)
个人代码如下: (1)递归: long long Fbl(int n) { if(n == 1 || n == 2) return 1; return Fbl(n-2) + Fbl(n-1); } int main() { //1 1 2 3 5 8 cout<< Fbl(4); return 0; } (2)非递归: long long Fbl(int n) { if
2015-01-17 19:42:41
736
原创 图的入门之的深度遍历
PS:终于开始图的学习之旅了,先来个开胃小菜,图的深度遍历,个人代码如下: #include #include using namespace std; void dfs(char a[][5], int row, int col, int r, int c, const char tag = '#') { if(r row - 1 || c col - 1) return; if(t
2015-01-16 22:04:11
572
原创 二分查找之天平称重,称出最重的小球
题目:有n个小球,其中有一个比其他的都要重,已知有一个天平,怎么用最少的次数把小球找出来? 个人代码如下: #include #include using namespace std; int GetAbnormalBall(int a[], int begin, int end, int &count) { if(begin == end) return a[begin];
2015-01-16 21:37:04
1659
原创 天平 (Not so Mobile, UVa 839)
题意:输入一个树状天平,根据力矩相等的原则判断是否平衡。就是W1D1= W2D2,其中W1,W2分别为左右两边砝码的重量,D为距离。 示意图如下: 个人代码如下: #include using namespace std; #define IsLeaf(w1, w2) ((w1) && (w2)) bool solve(int &w) { int W1, L1, W2, L2;
2015-01-08 10:53:03
620
原创 排序算法之归并排序
归并排序代码如下: #include using namespace std; void MergeArray(int a[], int begin1, int end1, int begin2, int end2) { int begin = begin1; const int len = end2 - begin1 + 1; int b[len]; int pos = 0; w
2015-01-07 09:55:54
491
原创 查找算法之二分查找
二分查找的代码如下: #include #include using namespace std; long BinarySearch(int a[], int begin, int end, int elem) { if(begin > end) return -1; int mid = (begin + end) / 2; //int mid = begin + (end -
2015-01-07 09:28:37
521
原创 排序算法之堆排序
堆排序的算法如下: #include using namespace std; void AdjustHeap(int a[], int begin, int end, int pos) { int lchild = 2 * pos - begin + 1; int rchild = 2 * pos - begin + 2; int TracePos = -1; if(lchild
2015-01-06 21:57:54
501
原创 排序算法之快速排序
快速排序的代码如下: #include #include using namespace std; int SortByOnce(int a[], int begin, int end); void QuickSort(int a[], int begin, int end); bool CheckResultIsRight(int a[], int len); int main() {
2014-12-28 14:59:56
454
原创 2014年去哪网算法笔试题
题目一: 1.写一个函数,转换相对路径为绝对路径,比如:/home/abs/../temp/new/../,输出路径为:/home/temp。 1. 写一个函数,转换相对路径为绝对路径,比如: /home/abs/../temp/new/../, 输出路径为: /home/temp 。 1. 写一个函数,转换相对路径为绝对路径,比如: /home/abs/../temp/new
2014-12-24 00:49:22
549
原创 friend (友元的一个妙用)
在软件设计的时候,我们如果希望一个对象只能由另一个对象生成,比如水果农厂里面可以结出各种各样的水果,而水果不能平白无故的产生。 所以水果对象的构造函数肯定是private,而水果农厂却可以NewFruit(), 其中将水果农厂(CFruitFarm)作为友元,插入到各种水果当中就可以实现这 个效果。下面举例说明: #include #include using namespace std
2014-12-23 10:42:36
730
原创 破损的键盘(Broken KeyBoard)Uva 11988
样例输入: This_is_a_[Beiju]_text [[]][][]Happy_Birthday_to_Tsinghua_University 样例输出: BeijuThis_is_a_text Happy_Birthday_to_Tsinghua_University 静态链表的实现:(用结构体数组模拟链表) #include using namespace
2014-12-21 14:46:38
726
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅