Data Structures and Algorithms with Object-Oriented Design Patterns (2 -- under construction)

 
Heap and Priority Queue
       Priority Tree are often used to the implementation of algorithms. It can improve the performance of these algorithms including Backtracking, Sorting and Graph algorithms.
       Binary Heap
              Complete Binary Tree, Perfect Binary Tree
              Put: put the item to the next position in the complete binary tree and make it heap ordered by moving it from bottom to the root. O (log n)
              Remove: remove the root element and move the last element in complete binary tree to the root and make it heap ordered by moving it form root to bottom. O (log n)
              Build Heap from Array: move every internal node to the bottom to make the heap ordered. O (n)
       Leftist Heap
              Leftist Tree: path length of the right subtree is no more than left one for every subtree
              Merge: using recursion, the tree with the bigger root merge with the right subtree of another tree. And then, if the path length of right subtree is more than left one, exchange them. O (log n1+log n2)
              Put: Merge the original tree with a new leftist heap containing only the new node O (log n)
              Remove: remove the root and merge the two children of the root O (log n)
       Binomial Queue
              Binomial Tree: B0={R}, Bk={R, Bk-1, Bk-2….B0}
                     The number of nodes at level l in the binomial tree of order k is given by the binomial coefficient (k, l)
              Binomial Queue: A forest of binomial tree with heap order
                     Remove tree: best O (1), worst O (log n)
                     Add tree: O (1)
                     Find minimum: O (log n)
                     Merge: O (log (m + n))
                     Put: Merge the original binomial queue with a new one containing the only node O (log n)
                     Remove: remove the root of the minimum binomial tree and then add all its children to the binomial queue
 
Set
       Array Set
       Bit-Vector Set
       Multiset
       Partition
              Implement a partition using a forest (using array)
              The nodes in the partition tree have three fields – items, parent and rank
              Find: find the root of the partition tree
              Join: join two partition tree
              Collapsing find: 1 find the root 2 assign all the nodes on the finding path to the root
              Union by size: attach the small tree to the root node of the larger one.
                     The height of partition tree is guaranteed to be O (log n)
              Union by rank (height): attach the tree with lower height to the one with higher height
                     The height of partition tree is guaranteed to be O (log n)
              Application: processing the Equivalence Relation (reflexive, symmetric, transitive)
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值