自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(40)
  • 收藏
  • 关注

原创 依附在Activity上的Fragment生命周期与Activity生命周期回调顺序

依附在activity上的fragment生命周期与activity生命周期回调顺序Activity创建Activity onCreateFragment onAttachFragment onCreateFragment onCreateViewFragment onActivityCreateFragment onStart

2016-11-03 14:14:59 613

原创 面试算法题:求出所有N位的二进制数

比如,求4位二进制数,就是要求出  [1000, 1100, 1010, 1110, 1001, 1101, 1011, 1111]开头第一位只能是1,因为0001是1 ,是一位二进制数当时想到的方法是 n为二进制,数字范围是2的N-1次方到2的N次方-1  那么写一个转换成二进制的函数,遍历一遍调用这个函数,就可以求出来了方法二:利用递归实现  最高位特殊考虑,除最高位以外,每个位都

2016-09-23 16:05:46 3615

原创 2016校招真题汇总3:扑克牌大小

题目描述扑克牌游戏大家应该都比较熟悉了,一副牌由54张组成,含3~A,2各4张,小王1张,大王1张。牌面从小到大用如下字符和字符串表示(其中,小写joker表示小王,大写JOKER表示大王):) 3 4 5 6 7 8 9 10 J Q K A 2 joker JOKER 输入两手牌,两手牌之间用“-”连接,每手牌的每张牌以空格分隔,“-”两边没有空格,如:4 4 4 4-joke

2016-09-03 23:57:50 988

原创 2016校招真题汇总2:简单错误记录

题目描述开发一个简单错误记录功能小模块,能够记录出错的代码所在的文件名称和行号。 处理:1.记录最多8条错误记录,对相同的错误记录(即文件名称和行号完全匹配)只记录一条,错误计数增加;(文件所在的目录不同,文件名和行号相同也要合并)2.超过16个字符的文件名称,只记录文件的最后有效16个字符;(如果文件名不同,而只是文件名的后16个字符和行号相同,也不要合并)3.输入的文件

2016-09-03 23:44:48 576 1

原创 2016校招真题汇总1:最高分是多少

题目描述老师想知道从某某同学当中,分数最高的是多少,现在请你编程模拟老师的询问。当然,老师有时候需要更新某位同学的成绩. 输入描述:输入包括多组测试数据。每组输入第一行是两个正整数N和M(0 < N <= 30000,0 < M < 5000),分别代表学生的数目和操作的数目。学生ID编号从1编到N。第二行包含N个整数,代表这N个学生的初始成绩,其中第i个数代表I

2016-09-03 23:37:00 340

转载 Halcon模板匹配——find_shape_model

转载自点击打开链接最近做机器视觉,做到模板匹配,主要用到两个函数,遇到一篇好文章介绍这两个函数介绍得很详细,转载来ind_shape_model(Image : :  //搜索图像                   ModelID, //模板句柄                  AngleStart,  // 搜索时的起始角度                  An

2016-08-24 15:16:53 12805

转载 Halcon模板匹配——create_shape_model

转载自点击打开链接最近做机器视觉,做到模板匹配,主要用到两个函数,遇到一篇好文章介绍这两个函数介绍得很详细,转载来create_shape_model(Template : ://reduce_domain后的模板图像                        NumLevels,//金字塔的层数,可设为“auto”或0—10的整数                   

2016-08-24 15:11:17 14573

原创 面试题:给定一个字符串,问是否能通过添加一个字母将其变为回文串

题目描述给定一个字符串,问是否能通过添加一个字母将其变为回文串。输入描述:一行一个由小写字母构成的字符串,字符串长度小于等于10。 输出描述:输出答案(YES\NO). 输入例子:coco 输出例子:YES#include#include#include#include #include using

2016-08-22 08:33:46 4064

原创 单例模式懒汉式静态内部类形式

静态内部类形式,既实现了线程安全,又避免了同步带来的性能影响public class Singleton { private static class LazyHolder { private static final Singleton INSTANCE = new Singleton(); } private Singl

2016-08-17 11:34:52 992

转载 Jave虚拟机划分的三个代: 年轻代、年老代和持久代

虚拟机中的共划分为三个代:        年轻代(Young Generation)、年老代(Old Generation)和持久代(Permanent Generation)。其中持久代主要存放的是Java类的类信息,与垃圾收集要收集的Java对象关系不大。年轻代和年老代的划分是对垃 圾收集影响比较大的。年轻代:        所有新生成的对象首先

2016-08-16 19:21:39 15426 5

原创 剑指offer面试题43:n个骰子的点数

#include "iostream"using namespace std;int g_maxValue = 6;void PrintProbability(int number){ if (number < 1) return; int *pProbabilities[2]; pProbabilities[0] = new int[g_maxValue*number + 1]

2016-07-28 08:04:12 295

原创 剑指offer面试题40:数组中只出现一次的数字

#include "iostream"using namespace std;unsigned int FindFirstBitIs1(int num){ int indexBit = 0; while (((num & 1) == 0) && (indexBit < 8 * sizeof(int))) { num = num >> 1; ++indexBit; } ret

2016-07-26 22:21:32 229

原创 剑指offer面试题39:二叉树深度以及判断平衡二叉树

#include "iostream"using namespace std;struct BinaryTreeNode{ int data; BinaryTreeNode *left; BinaryTreeNode *right;};int TreeDeep(BinaryTreeNode *pRoot){ if (pRoot == NULL) return 0; int

2016-07-26 19:51:20 312

原创 剑指offer面试题38:数字在排序数组中出现的次数

#include "iostream"using namespace std;int GetFirstK(int *data, int length,int k, int start,int end){ if (start > end) return -1; int middleIndex = (start + end) / 2; int middleData = data[mid

2016-07-26 19:38:29 222

原创 剑指offer面试题36:数组中的逆序对

#include "iostream"using namespace std;int InversePairsCore(int* data,int* copy,int start,int end){ if (start==end) { copy[start] = data[start]; return 0; } int length = (end - start) / 2;

2016-07-25 16:18:44 266

原创 剑指offer面试题34:丑数

#include "iostream"using namespace std;int Min(int num1,int num2,int num3){ int min = num1 < num2 ? num1 : num2; min = min < num3 ? min : num3; return min;}int GetUglyNumber(int index){ if (

2016-07-25 14:45:56 310

原创 剑指offer面试题33:把数组排成最小的数

#include "iostream"using namespace std;const int gMaxLength=10;char* gCombine1 = new char[gMaxLength * 2 + 1];char* gCombine2 = new char[gMaxLength * 2 + 1];int compare(const void* strNum1, const

2016-07-25 08:47:07 220

原创 剑指offer面试题28:字符串的排列

#include "iostream"using namespace std;struct BinaryTreeNode{ int data; BinaryTreeNode *left; BinaryTreeNode *right;};void Permutation(char * pStr, char *pBegin){ if (*pBegin == '\0') cout

2016-07-19 17:25:47 298

原创 剑指offer面试题27:二叉搜索树和双向链表

#include "iostream"using namespace std;struct BinaryTreeNode{ int data; BinaryTreeNode *left; BinaryTreeNode *right;};BinaryTreeNode *Convert(BinaryTreeNode *pRoot){ BinaryTreeNode *pLastNode

2016-07-19 16:19:59 251

原创 剑指offer面试题25:二叉树中和为某一值的路径

#include "iostream"#include "iomanip"#include "stack"#include "queue"#include "vector"using namespace std;struct BinaryTreeNode{ int data; BinaryTreeNode *left; BinaryTreeNode *right;};void

2016-07-15 17:12:10 326

原创 剑指offer面试题24:二叉搜索树的后序遍历序列

#include "iostream"#include "iomanip"#include "stack"#include "queue"using namespace std;struct BinaryTreeNode{ int data; BinaryTreeNode *left; BinaryTreeNode *right;};bool verifySquenceOfBS

2016-07-15 16:28:04 224

原创 剑指offer面试题23:从上到下打印二叉树

#include "iostream"#include "iomanip"#include "stack"#include "queue"using namespace std;struct BinaryTreeNode{ int data; BinaryTreeNode *left; BinaryTreeNode *right;};void printFromTopToBot

2016-07-15 16:00:21 217

原创 剑指offer面试题22:栈的压入、弹出序列

#include "iostream"#include "iomanip"#include "stack"using namespace std;bool isPopOrder(const int *pPush,const int *pPop,int length){ bool bPossible = false; if (pPush!=NULL&&pPop!=NULL&&lengt

2016-07-15 14:59:22 314

原创 剑指offer面试题20:顺时针打印矩阵(自己的算法,不是书上的)

#include "iostream"#include "iomanip"using namespace std;struct BinaryTreeNode{ int data; BinaryTreeNode *left; BinaryTreeNode *right;};void printMatrix(int number[][4],int rows,int columns){

2016-07-15 10:17:23 201

原创 剑指offer面试题19:二叉树的镜像

#include "iostream"using namespace std;struct BinaryTreeNode{ int data; BinaryTreeNode *left; BinaryTreeNode *right;};void mirrorRecursively(BinaryTreeNode *pNode){ if ((pNode == NULL) || (pN

2016-07-15 08:59:53 217

原创 剑指offer面试题18:树的子结构

#include "iostream"using namespace std;struct BinaryTreeNode{ int data; BinaryTreeNode *left; BinaryTreeNode *right;};bool doesTree1HasTree2(BinaryTreeNode *pRoot1, BinaryTreeNode *pRoot2){ i

2016-07-15 08:51:05 224

原创 剑指offer面试题17,18:反转链表+合并有序链表

#include "iostream"using namespace std;struct ListNode{ int data; ListNode *pnext;};ListNode* merge(ListNode *pHead1,ListNode *pHead2){ if (pHead1 == NULL) return pHead2; else if (pHead2 ==

2016-07-14 15:31:08 168

原创 剑指offer面试题14:调整数组顺序使奇数位于偶数前面

#include "iostream"using namespace std;void reOrder(int *data,int length){ if (data == NULL || length <= 0) return; int* start = data; int *end = data + length - 1; while (start<end) { whi

2016-07-12 20:06:20 190

原创 剑指offer面试题12:打印1到最大的n位数(2)

#include "iostream"using namespace std;void printNumber(char *number){ int length = strlen(number); bool isBegin0 = true; for (int i = 0; i < length;i++) { if (isBegin0&&number[i] != '0')

2016-07-12 16:24:19 232

原创 剑指offer面试题12:打印1到最大的n位数(1)

#include "iostream"using namespace std;bool Increment(char *number){ int length = strlen(number); int index = length-1; bool isOverFlow = false; for (int i = index; i >= 0;i--) { if (isOverF

2016-07-12 15:49:15 322

原创 剑指offer2.4.1查找和排序:快速排序

#include "iostream"using namespace std;int randomInRange(int start,int end){return (rand() % (end-start+1) + start);}int partition(int data[],int length,int start,int end){if (data ==

2016-07-12 08:12:27 244

原创 剑指offer面试题8:旋转数组的最小数字

#include "iostream"#include #include "stack"using namespace std;int minInOrder(int* number, int index1, int index2);int min(int *number,int length){ if (number == NULL || length <= 0) throw ne

2016-07-11 22:06:37 216

原创 剑指offer面试题7:用两个栈实现队列

#include "iostream"#include #include "stack"using namespace std;template class cQueue{public: void appendTail(const T ¬es); T deleteHead();private: stack stack1; stack stack2;};template

2016-07-10 14:57:20 202

原创 剑指offer面试题6:重建二叉树

#include "iostream"#include #include "stack"using namespace std;struct BinaryTreeNode{ int data; BinaryTreeNode *left; BinaryTreeNode *right;};BinaryTreeNode* construct(int *preorder,int *ino

2016-07-09 22:31:41 230

原创 剑指offer面试题5:从尾到头打印链表

#include "iostream"#include #include "stack"using namespace std;struct ListNode{ int data; ListNode *next;};void printdigui(ListNode *pHead){ if (pHead!=NULL) if (pHead->next != NULL) pri

2016-07-08 16:23:53 174

原创 剑指offer:2.3.3链表:删除第一个含有某值节点

#include "iostream"#include using namespace std;struct ListNode{ int data; ListNode *next;};void removeNode(ListNode **pHead,int value){ if (*pHead == NULL) return; ListNode *tobedelete=NU

2016-07-08 15:47:41 297

原创 剑指offer2.3.3链表:在链表末尾添加一个节点

#include "iostream"#include using namespace std;struct ListNode{ int data; ListNode *next;};void addToTail(ListNode **pHead,int value){ ListNode *pNew = new ListNode(); pNew->data = value; p

2016-07-08 15:19:06 995

原创 剑指offer面试题4:替换空格

#include "iostream"#include using namespace std;%length为字符数组p的总容量void replaceBlank(char *p,int length){ if (p == NULL || length <= 0) return; int blankNum = 0; int originalLength = 0; int i

2016-07-08 14:39:33 229

原创 剑指offer面试题3:二维数组中的查找

#include "iostream"#include using namespace std;bool find(int *matrix,int rows,int columns,int number ){ bool find = false; if (matrix != NULL&&rows > 0 && columns > 0) { int row = 0; int co

2016-07-08 14:36:15 243

原创 elipse安装Genymotion插件时候输入网址没有显示可以下载的

原来是要勾掉下面的group items by category,就会genymotion的项目了接下去一路next就可以了,安装也很快。提示重启eclipse以后,会出现一个genymotion的小图标,点击设置genymotion的安装目录就可以用了折腾了好久。。

2015-08-09 10:01:28 686

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除