自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Steven Li's Zone

A fighting panda. Learning makes me happy.

  • 博客(5)
  • 收藏
  • 关注

原创 Data Structure: Binary Index Tree(LC308作为例子)

Binary Index Tree适合用以Range Query. 例如:求一个大区间的某个小区间的和。 为什么要使用Binary Index Tree? 先看看,如果不使用Binary Index Tree的话,我们可以使用的方法。 1)直接求。那么复杂度是O(mn)。m是查询次数,n是大区间的元素个数。 2)使用sum的array,建立一个array,每个ind

2017-09-29 23:10:17 1427

原创 Data Structure: Segment Tree 线段树

线段树主要用于Range Query. 适用问题在:这个大区域的某个子区间最小值,这个大区间的某个子区间的和等等。线段树的某个叶子节点都是代表一个大区间的元素。 为什么要使用线段树? 那先让我们看看,如果不使用线段树,上述的求某个子区间最小值的问题该如何解决。 方案1:每次query都去遍历一次子区间。如果有m次查询,有n个元素的话,时间复杂度就是O(mn)。

2017-09-29 12:02:29 458

原创 System Design: How to design a tiny URL

At first glance, this problem seems to very easy. We can solve it with a HashMap.  However, if you think it more deeper, you will find out HashMap approach does not have scalablity and persistenc

2017-09-28 03:33:13 1523

原创 Data Structure: 图的拓扑排序

Course Schedule There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is e...

2017-09-13 12:21:39 355

原创 Data Structure: Trie(字典树)

字典树是一个用数组(数组代表子节点数目是静态的)来表示子节点的树结构。同时节点也需要域:boolean isEnd。  本文章参考:https://leetcode.com/problems/implement-trie-prefix-tree/solution/ Trie的一些应用:1)Autocomplete; 2) Spell checker; 3) IP routing

2017-09-10 03:02:17 704

空空如也

空空如也

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

TA关注的人

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