自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(12)
  • 资源 (2)
  • 收藏
  • 关注

转载 leetcode笔记—二进制数中1的个数

基本思想:x=x&(x-1)可以消除x最右边的1;1.给出一个32位的二进制数,统计其中1的个数class Solution {public: int hammingWeight(uint32_t n) { //n=n&(n-1)可以消去最右边的1 int res=0; while(n) {

2016-04-26 21:46:16 1572

原创 数据结构—排序

1.希尔排序  shellsort增量序列d = {n/2 ,n/4, n/8 .....1} n为要排序数的个数void ShellInsertSort(int a[], int n, int dk) //n个要排序的数,dk是增量{ for(int i= dk; i<n; ++i){ if(a[i] < a[i-dk]){

2016-04-21 15:29:06 259

原创 leetcode笔记—判断查找二叉树

首先说明一下二叉树和二叉搜索树的区别。二叉树指这样的树结构,它的每个结点的孩子数目最多为2个;二叉搜索树是一种二叉树,但是它有附加的一些约束条件,这些约束条件必须对每个结点都成立:结点node的左子树所有结点的值都小于node的值。结点node的右子树所有结点的值都大于node的值。结点node的左右子树同样都必须是二叉搜索树。假定当前结点值为k。对于二叉树中每个结点,判断其左孩子

2016-04-20 09:52:04 886

原创 leetcode—图的遍历

1、图的克隆,利用散列/** * Definition for undirected graph. * struct UndirectedGraphNode { * int label; * vector neighbors; * UndirectedGraphNode(int x) : label(x) {}; * }; */class Solution

2016-04-20 08:44:32 840

原创 Leetcode-关于二叉树的对称性

二叉树的镜像对称问题,是一个easy的题/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NUL

2016-04-14 20:04:28 680

原创 leetcode-构造二叉树

1.由前序遍历和中序遍历构造二叉树/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL)

2016-04-13 19:34:31 597

原创 leetcode笔记-Path Sum

class Solution {public: bool hasPathSum(TreeNode* root, int sum) { if(root==NULL) return false; if(root->val==sum&&root->left==NULL&&root->right==NULL) return true; return

2016-04-12 20:16:04 471

原创 Leetcode笔记—最大路径和

public: int maxPathSum(TreeNode* root) { int maxsum=INT_MIN; dfs(root,maxsum); return maxsum; } int dfs(TreeNode* root,int& maxsum) { if(root==NULL) ret

2016-04-12 17:34:14 706

原创 leetcode笔记-Kth Smallest Element in a BST

思路:定义一个中序遍历的函数,调用中序遍历将各个节点都存在VECTOR中,其中的数是从小到大的排列的,再取第K个最小的值/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeN

2016-04-11 18:34:46 439

原创 leetcode笔记-层序遍历

/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * } */class

2016-04-10 19:56:01 925

原创 leetcode笔记-zigzag层序遍历

/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */clas

2016-04-10 16:48:33 506

原创 Leecode笔记-中序遍历

/**中序遍历 * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */

2016-04-10 15:23:00 462

统计学习方法高清版

高清的统计学习方法扫描版,已经学过了,是机器学习深度学习入门必学的书。

2018-10-08

ICLR2017文献

2017年ICLR相关文献PPT版。

2018-05-25

空空如也

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

TA关注的人

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