自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 BRTree 删除Practice

2017-05-30 15:40:58 373

原创 Count of Smaller Numbers After Self

You are given an integer array nums and you have to return a new counts array.The counts array has the property where counts[i] is the number of smaller elements to the right of nums[i]. Example:

2017-05-24 22:04:11 214

原创 红黑树 RBTreee

1.  红黑树是二叉查找树. 2.  插入 性质: 1. 插入新节点总是红色节点 2. 如果插入节点的父节点是黑色, 能维持性质 3. 如果插入节点的父节点是红色, 破坏了性质. 故插入算法就是通过重新着色或旋转, 来维持性质 算法: 假设要插入的节点标为N,N的父节点标为P,N的祖父节点标为G,N的叔父节点标为U. 1. N = root, N->黑, over。 2. P

2017-05-17 13:25:52 227

原创 二叉查找树

1. 查找 Status SearchBST(BiTree T, KeyType key, BiTree f, BiTree &p){ if(!T) { //查找不成功 p=f; return false; } else if (key == T->data.key) { //查找成功 p=T; return true; } else if (

2017-05-15 15:59:59 214

原创 HighestBitNum

Java  public static int highestOneBit(int i) { // HD, Figure 3-1 i |= (i >> 1); i |= (i >> 2); i |= (i >> 4); i |= (i >> 8); i |= (i >> 16);

2017-05-12 16:55:10 191

原创 树状树组

按照Peter M. Fenwick的说法,正如所有的整数都可以表示成2的幂和,我们也可以把一串序列表示成一系列子序列的和。采用这个想法,我们可将一个前缀和划分成多个子序列的和,而划分的方法与数的2的幂和具有极其相似的方式。一方面,子序列的个数是其二进制表示中1的个数,另一方面,子序列代表的f[i]的个数也是2的幂。 三个概念 1. Lowest bit number...

2017-05-12 16:08:59 341

原创 LowestBitNum

Given an integer, return an interger which has only one 1 bit, and the postion is as same as the lowest 1 bit of the input. 返回输入最低位是1所在位置所代表的数。 如 F(0001010) = 10  int x =0x80000000; int r1 = x&(x

2017-05-11 17:01:45 144

原创 Predict the Winner

Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on. Each time a player picks a

2017-05-09 13:27:07 179

原创 随机数

Given a singly linked list, return a random node's value from the linked list. Each node must have the same probability of being chosen. int getRandom() { int res = head->val; Li

2017-05-07 12:54:55 178

原创 算法笔记 - 数组

1. 排序可巧利用数组索引 如:Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) f

2017-05-02 22:02:26 663

空空如也

空空如也

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

TA关注的人

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