- 博客(33)
- 收藏
- 关注
原创 Android ClickableRoundedBackground Span实现(初版)
一、自定义圆角背景spanpackage com.taobao.search.searchtip;import android.graphics.Canvas;import android.graphics.Paint;import android.graphics.RectF;import android.taobao.util.TaoLog;import android.text.sty
2015-12-01 19:57:35
1617
1
原创 GridView Adapter里的getView为啥会多次调用position 0
GridView Adapter里的getView为啥会多次调用position 0一、问题描述GridView Adapter里的getView方法总会调用很多次的position 0 图中的GridView 包含9个大小相同的itemView,区别在于itemView中包含的textView中的文字不同。二、问题分析getView方法既然是getView引起的,我们就先从这个方法本身入手,
2015-10-09 21:17:18
6033
1
原创 ArrayList遍历方式比较实验
遍历方式增强型for循环 也称为for-each循环,是jdk 1.5中新增的循环模式,我们在程序中会越来越倾向于使用这种方式遍历集合,因为它使用起来更方便。 而在郭大侠的文章:Android最佳性能实践(三)中提到对于ArrayList这种集合,“自己的手写for循环比for-each快”,针对这一结论,我们做一个小实验来验证下结论的可靠性:实验过程采用3种遍历ArrayList的
2015-10-08 20:34:25
734
原创 反思-工作总结(20150706-0921)
工作快3个月了,这三个月以来的关键词就是:反思。三个月的工作,会有压力,会有小小的成就感,会在不断寻求突破,会一直给自己打气。但是与此同时,会意识到自己身上存在很多问题,列举如下:1.硬实力方面:处理问题或者需求时,不善于考虑到更多的方面,没有深入思考很多相关的东西,换句话说:就是没有把东西做到极致;做需求时,一些技术的使用,相关业务的牵连,并没有思考得十分透彻,而是停留在
2015-09-21 23:12:55
757
原创 随笔20150223
连日的感冒像个矫情的小情人,紧紧抓住你的衣角不肯离去。近日以来与老妈的一次争执,让我看到个性中的注定柔软,但也难免积压爆发,人应该就是这样的吧,会被一些特定的语气与言语触及底线,也越是因为亲人,越敢于自我暴露,所以下一次对自己最亲的人,性子还是要收一收的。昨日的悲伤欲裂,今日一觉醒来,想想也不过是昨天,我们要留给长大一些时间,而很多事情也不过是再加个期限。在写这样的轻博客之前,
2015-02-23 13:47:48
491
原创 C++ 从上到下,从左至右打印二叉树
代码如下:#include #include "BinaryTree.h"#include using namespace std;void PrintTree_from_head_to_tail(TreeNode* proot){ if(proot == NULL) return; deque tree_que; TreeNode* node = proot; tre
2014-09-19 15:51:18
1272
原创 C++ 调整数组使得奇数位于偶数后面
代码如下:/*调整数组的顺序使得数组中偶数在奇数前面*/#include #include using namespace std;class Solution{public: void swap(int &a ,int &b) { int temp = b; b = a; a = temp; } int * reorder(int array[],int le
2014-09-15 13:53:29
1378
原创 C++ 求斐波那契数列 递归法 迭代法
代码:/*递归法、迭代法求斐波那契数列*/#include #include using namespace std;class Solution{public: int Fib(int n) { if(n == 0) return 0; if(n == 1) return 1; if(n > 1) return Fib(n-1) + Fib(n-
2014-09-14 11:23:20
8021
原创 C++ 求旋转字符串中的最小值
思路比较简单,直接看代码即可:/*求一个旋转字符串中最小值*//*思路:遇到没有旋转以及数组中相同位置元素相等的采用顺序查找*/#include #include #include using namespace std;class Solution{public: int find(int array[],int length) { int i=0, min = ar
2014-09-14 10:52:10
641
原创 C++ 二分查找的递归与非递归实现
非常简单的东西,直接看看代码。/*二分查找的递归与非递归实现*/#include using namespace std;//设定为非重复的递增整数列:循环方法int BinarySearch(int array[],int value,int length){ if(array == NULL || length < 1) return -1; int lp = 0; i
2014-09-12 22:25:52
504
原创 LeetCode:Construct Binary Tree from Preorder and Inorder Traversal
题目:Given preorder and inorder traversal of a tree, construct the binary tree.代码如下:
2014-09-12 20:06:12
793
原创 LeetCode: Combinations 递归回溯 2种实现方法
题目:Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,4], [2,3], [1,2], [1,3],
2014-09-12 13:50:04
532
原创 Leetcode:subsets2 duplicate number
题目如下:Given a collection of integers that might contain duplicates, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not co
2014-09-09 17:39:24
465
原创 Leetcode: Subsets
题目:Given a set of distinct integers, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not contain duplicate subsets.
2014-09-09 16:56:52
470
原创 Leetcode Anagrams
题目:Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.代码如下:
2014-09-09 11:39:51
350
原创 Leetcode:Remove Duplicates from Sorted List
题目:Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.代码如下:
2014-09-02 18:51:29
424
原创 O(1)时间求一个栈的最小值
/*O(1)求出一个栈的最小值*/#include #include #include #define maxsize 10using namespace std;int main(){ stack source; stack compare; for(int i = 0;i < maxsize;i++) { int input; cin >> input;
2014-09-02 17:57:02
492
原创 LeetCode: Linked List Cycle II
题目:Linked List Cycle II :Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Follow up:Can you solve it without using extra space?代码:
2014-08-27 19:45:55
351
原创 PAT 1001 1002
PAT题目1001:解题思路:这道题,虽然看起来很简单,但是还是有很多细节要注意的。因为在运算各个位的时候,低位先得到,高位后得到,而要保证输出的顺序正确,所以采用了栈的结构。代码如下:#include #include #include #include using namespace std;int main(){ int
2014-08-15 19:09:23
452
原创 内存那点儿事儿(一)
一、Linux分配给进程中的地址空间:l 代码段存储程序文本,又称文本段,指令指针从这里获得指令,可以被共享。l 数据段用来存储数据。分为初始化为非0的数据区,BBS(Block Started by Symbol 用来存放未初始化的全局数据和静态数据)和堆(Heap 用来动态分配内存,就是说malloc等函数可以在这里或的分配内存,地址是向上增长的)l 堆栈段(St
2014-08-07 15:45:16
500
原创 C++小实验之多态性理解
#include #include using namespace std;class Cup{public:virtual void color() = 0;};class TeaCup{public:virtual void color(){cout << "have a tea,change a mood " << endl;}};class Fathor{public:virtual vo
2014-08-01 15:11:22
513
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人