Data Structure
文章平均质量分 84
puffsun
这个作者很懒,什么都没留下…
展开
-
二叉搜索树的节点删除算法
删除节点是二叉搜索树操作中最复杂的,但对有些应用又非常重要,有必要好好研究一下。 一个取巧的办法:在树节点中加入一个boolean字段,比如isDeleted。需要删除一个节点时就把这个字段置为true,其他操作比如find()在查找之前先判断这个节点是否已经标记为删除了,这样删除的节点将不会改变树的结构,当然这样做还会继续保留这种已经删除的节点。对某些应用场景,这种做法是有优势的,比如已...2011-12-08 22:21:01 · 413 阅读 · 0 评论 -
基础数据结构和算法十:2-3 search tree
Binary search tree works well for a wide variety of applications, but they have poor worst-case performance. Now we introduce a type of binary search tree where costs are guaranteed to be logarit...原创 2013-11-30 11:07:02 · 361 阅读 · 0 评论 -
基础数据结构和算法十一:Red-black binary search tree
The insertion algorithm for 2-3 trees just described is not difficult to understand; now, we will see that it is also not difficult to implement. We will consider a simple representation known as...原创 2013-12-01 12:12:35 · 237 阅读 · 0 评论 -
基础数据结构和算法十二:Hash table
Search algorithms that use hashing consist of two separate parts. The first part is to compute a hash function that transforms the search key into an array index. Ideally, different keys would map...原创 2013-12-02 22:06:01 · 211 阅读 · 0 评论 -
基础数据结构和算法十三:Undirected Graphs
A graph is a set of vertices and a collection of edges that each connect a pair of vertices. Vertex names are not important to the definition, but we need a way to refer to vertices. By convention, ...原创 2013-12-13 20:15:59 · 345 阅读 · 0 评论 -
基础数据结构和算法十三:Undirected Graphs (2)
Design pattern for graph processing. Since we consider a large number of graph-processing algorithms, our initial design goal is to decouple our implementations from the graph representation. T...原创 2013-12-13 22:51:29 · 270 阅读 · 0 评论 -
基础数据结构和算法十四:Directed Graphs
In directed graphs, edges are one-way: the pair of vertices that defines each edge is an ordered pair that specifies a one-way adjacency. Many applications (for example, graphs that represent the ...原创 2013-12-15 22:40:30 · 904 阅读 · 0 评论