- 博客(10)
- 资源 (12)
- 收藏
- 关注
原创 剑指offer编程题——10 二进制中1的个数
#include <iostream>using namespace std;/* 输入一个数N,求它的二进制中的1的个数 ①:每次左移N,做N & 1运算; ②:每次右移1,做N & new1运算; ③:每次做 N= N & (N-1)运算,会把最右边的1变成0*/int NumberOf1_1(int n){ //不可取 int cnt ...
2018-03-16 14:48:33 169
原创 剑指offer编程题——09 斐波那契数列以及相关问题
#include <iostream>using namespace std;/* 高效的斐波那契的循环式解法 递归式缺点:层数太多会溢出,计算重复,效率低*/long long FibonacciInCycle(unsigned n){ int result[2] = { 0, 1 }; if (n < 2) return result[n]; long...
2018-03-16 14:46:23 252
原创 剑指offer编程题——08_2 堆排序的头文件
/*最大堆定义*/#include <iostream>using namespace std;class MaxHeap{private: int size; //最大堆的元素数目 int * array; //最大堆数组的首地址指针public: MaxHeap(int array[], int n); //用已有数组初始化一个最大堆 void buildHeap(); //...
2018-03-16 14:43:19 247
原创 剑指offer编程题——08_1 几种典型的排序算法实现
/* 几种典型的排序算法*/#include <iostream>#include "MaxHeap.h" //包含进堆的头文件using namespace std;//快速排序void quicksort(int a[], int low, int high){ if (low >= high){ return; } int first = low;...
2018-03-16 14:41:21 262
原创 剑指offer编程题——08 旋转数组中的最小数字
//寻找旋转数组中的最小值#include <iostream>#include <exception>using namespace std;/** MyCoding 比较麻烦int minNumber(int *arr, int len){ if (len <= 0 || arr == NULL) throw exception("Array is...
2018-03-16 14:31:37 150
原创 剑指offer编程题——07 两个栈实现队列
#include <iostream>#include <exception>#include <stack>using namespace std;template<typename T> class CQueue{private: stack<T> stack1; stack<T> stack2;publi...
2018-03-16 14:29:56 164
原创 剑指offer编程题——06 重建二叉树
#include<iostream>using namespace std;struct BinaryTreeNode{ int m_value; BinaryTreeNode* m_left; BinaryTreeNode* m_right;};BinaryTreeNode* ConstructCore(int* startPre, int* endPre, ...
2018-03-16 14:28:32 147
原创 剑指offer编程题——05 从头到尾打印链表
//输入一个链表的头结点,反向打印节点值/* * 尾插法新建链表注意:** 由于新插入节点时会改变头指针,所以传入的参数* 应该是指针的指针,否则出了函数,pHead仍然是空指针;在指针做参数传递给函数的时候:只能保留指针指向的对象(*P)改变的值不能保留指针本身(P)所做得修改在需要修改指针本身的时候,需使用指向指针的指针作为参数,也便是传值与传址的差别所在。*//*...
2018-03-16 14:27:06 133
原创 剑指offer编程题——04 替换空格
//写函数,将字符串中的每个空格替换成20%// 首先找出所有的空格数,然后整体后移,最后填充三个字符/* 特殊字符可能会无法显示,需要ASCII码转换,%32空格*/#include <iostream>#include <cstring>using namespace std;char* replacestr(char str[]){ //没必要定义新的数...
2018-03-16 14:25:14 181
原创 剑指offer编程题——03 二维数组中的查找
// 二维数组中的查找/* 1 2 8 9 2 4 9 12 4 7 10 13 6 8 11 15*/#include <iostream>#define LEN 4using namespace std;bool SearchKey(int a[][LEN], int key){ bool flag = false; if (a == NULL)...
2018-03-16 14:21:36 157
2017百度美团滴滴等机器学习岗面试笔试经验
2018-03-17
SVM+SFS+KNN+SBS+LASSO+SRC算法(matlab版)
2017-09-11
EasyEnsemble算法(matlab版)
2017-09-11
哈工大_生物计算_计算机视觉类_张大鹏论文2
2017-09-11
哈工大生物计算实验室张大鹏论文1
2017-09-11
自然图像统计:一种早期计算机视觉的概率方法(英文原版)
2017-08-25
学术界经典的图像处理论文合集
2017-08-17
深入体验VC++项目开发源代码
2017-08-17
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人