![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
剑指offer
文章平均质量分 72
wyj7260
这个作者很懒,什么都没留下…
展开
-
05_从尾到头打印链表
#include #include using namespace std; typedef struct ListNode { int data; struct ListNode * next; ListNode(int d) : data(d), next(NULL){} }; ListNode *initList() { ListNode * head = NULL;原创 2014-09-06 13:22:02 · 1147 阅读 · 0 评论 -
剑指offer_02_二维数组中的查找
#include using namespace std; bool ifHasNum(int *data,int row, int col, int num){ if(data == NULL || row <= 0 || col <= 0){ return false; } int i = 0; int j = col - 1; while(i = 0){ if(nu原创 2014-09-06 10:34:20 · 774 阅读 · 0 评论 -
11_数值的整数次方
#include using namespace std; bool isValid = true; bool isPositive = true; bool doubleEqual(double number1, double number2) { if(number1 - number2 -0.0000001) { return true; } else { return原创 2014-09-06 15:59:54 · 576 阅读 · 0 评论 -
09_斐波那契数列
#include #include #include using namespace std; long long fibRecursion(unsigned n) { if(n <= 0) { return 0LL; } if(n == 1) { return 1LL; } if(n >= 2) { return fibRecursion(n - 1) +原创 2014-09-06 14:22:38 · 874 阅读 · 0 评论 -
10_二进制中1的个数
#include using namespace std; int main() { unsigned int number = 9; cout<<"number:"<<number<<endl; int count_one = 0; while(number) { count_one++; number = number & (number - 1); }原创 2014-09-06 14:50:44 · 509 阅读 · 0 评论 -
017_合并两个排序的链表
#include #include using namespace std; typedef struct ListNode { int data; struct ListNode * next; ListNode(int d) : data(d), next(NULL){} }; ListNode *initList(int *array, unsigned int lengt原创 2014-09-06 22:05:29 · 776 阅读 · 0 评论 -
031_连续子数组的最大和
#include #include using namespace std; bool isValid = true; int FindGreatestSumOfSubArray(int *data, int length) { isValid = true; if (data == NULL || length == 0) { isValid = false; return原创 2014-09-07 16:54:38 · 706 阅读 · 0 评论 -
057_删除聊表中的重复的节点
#include #include using namespace std; typedef struct ListNode { int data; struct ListNode * next; ListNode(int d) : data(d), next(NULL){} }; ListNode *initList(int *array, unsigned int lengt原创 2014-09-13 22:32:28 · 817 阅读 · 0 评论 -
042_翻转单词顺序
/* * Given an array of integers, every element appears three times except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without u原创 2014-10-04 15:41:38 · 971 阅读 · 0 评论