1 / 39

Van Emde Boas Trees

Van Emde Boas Trees. Elif Tosun (252a-aa) CSC 252 – Final Project. Outline . Introduction “Silly” Priority Queue Stratified Tree Structure Operations on the Stratified Tree Structure Conclusions My Contribution References. Introduction. Main problem in operations for Set Manipulation

glenna
Download Presentation

Van Emde Boas Trees

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Van Emde Boas Trees Elif Tosun (252a-aa) CSC 252 – Final Project

  2. Outline • Introduction • “Silly” Priority Queue • Stratified Tree Structure • Operations on the Stratified Tree Structure • Conclusions • My Contribution • References

  3. Introduction • Main problem in operations for Set Manipulation • Random Access (insert/delete/membership) • Ordered Representation (predecessor/successor) • Some data structures: binary heap, AVL trees, 2-3 trees, etc. • Lower Bounds for a Restricted Universe • Motivation: Enumeration Algorithms

  4. “Silly” Priority Queue • Structure • n = 2k leaves, height = k • Leaves with priorities from {1, 2,…, n} • k-bit representation (root to leaf) • 0, for left • 1, for right

  5. “Silly” PQ – Structure (Cont’d) • Subset S  {1,..,n} Representation • Mark leaves in S and all nodes on the paths from root to the marked leaves.

  6. “Silly” PQ – (Cont’d)Sketches of Algorithms • Insert(i) • Delete(i) • Member(i) • Min • Predecessor

  7. “Silly” PQ – (Cont’d)Sketches of Algorithms • Insert(i) • Delete(i) • Member(i) • Min • Predecessor

  8. “Silly” PQ – (Cont’d)Sketches of Algorithms • Insert(i) • Delete(i) • Member(i) • Min • Predecessor

  9. “Silly” PQ – (Cont’d)Sketches of Algorithms • Insert(i) • Delete(i) • Member(i) • Min • Predecessor

  10. “Silly” PQ – (Cont’d)Sketches of Algorithms • Insert(i) • Delete(i) • Member(i) • Min • Predecessor

  11. “Silly” PQ – (Cont’d)Sketches of Algorithms • Insert(i) • Delete(i) • Member(i) • Min • Predecessor

  12. Improvements? • Divide and Conquer Strategy. • Start with a tree of height 2k, n = 2^(2k) • Divide the universe {1, …, n} into n^(1/2) blocks of size n^(1/2). Insert/Delete locally • Run time recurrence: T(n) = T(n^(1/2)) + 1 • Result : T(n) = O(loglogn)

  13. Stratified Tree Structure • Based on Divide and Conquer Approach mentioned before. • Two types of information available for each node: • Static Information • Dynamic Information

  14. Static Information • Level: Length of path from a node to its leaves • Rank: x, for greatest divisor 2^x of the level of a node. For leaves, rank = k+1 where height= 2^k • Position: • Leaves: number in {1, …, n} representing the leaf • Internal nodes:position of rightmost leaf of its lefthand son. • Canonical Subtree of rank d (CS): Binary subtree having as a root node of rank >= d, as leaves descendants at the nearest level of rank >=d.

  15. Static Information(Cont’d) • Left Canonical Subtree(LCS): Includes all left hand side descendants • Upper Canonical Subtree(UC): Subtree of rank d, having the node as a leaf. • Lower Canonical Subtree(LC): Subtree of rank d, having the node as a root. • Reach: LC+UC

  16. Static Information Visualized

  17. Dynamic Information • Internal Nodes: • lmin: leftmost present leaf in LLC(v) • lmax: rightmost present leaf in LLC(v) • rmin: leftmost present leaf in RLC(v) • rmax: rightmost present leaf in RLC(v) • ub: +, if there exists a branchpoint on the path between the top of LC and v. -, otherwise

  18. Some definitions… • Branch Point: An internal node with 2 present sons • Active Node: A present node that has at least one dynamic field that doesn’t equal null. Note: For some operations to be done in O(1) nodes are prevented from being active unless needed.

  19. Properness Condition Let v be a present internal node. V is active there exists a branchpoint in the interior of the reach of v. Note: a leaf is active it’s present root is active set  null

  20. Representation of S • Leaves corresponding to elements of S and their ancestors are marked to be present. • Information on which present nodes are active is computed. – using Properness Condition • Dynamic fields of all active and non-active nodes are given their proper values.

  21. An Example:

  22. An Example:

  23. An Example:

  24. An Example:

  25. An Example:

  26. An Example:

  27. An Example:

  28. An Example:

  29. An Example:

  30. Operations on the Stratified Tree • Insert:Let l to be the leaf to be inserted. If (no present leaves exists on l’s side of the tree) insert as before Else compute the fathers of l(=hl) and the present leaf p (=hp). if no branchpoint exists on l’s side of CS hp is present without being active. hl is present iff hp = hl

  31. Operations- Insert (Cont’d) if hl is present insert l under hp = hl if hl is not present insert l as a leaf to a node above hp.

  32. Operations – Insert (Cont’d) If a branch point does exist on l’s side of CS hl is present iff it’s active if hl is active insert leaf as a child to hl if hl is not active insert leaf as a child to a node above hp

  33. Operations on the Stratified Tree • Delete: Makes a leaf non-present as well as its ancestors up to the lowest branch point. • Compute hl • Proceed to the upper branch point of hl • Consider the other son of the branchpoint • Change path from that son to the root of tree so that hl is not included • Mark as non-present the leaf and the path above until the “former” upper brachpoint of hl

  34. Operations – Delete(Visualized)

  35. Summary • What is important in these operations is that when inserting or deleting you only deal with the canonical subtree of the father of a leaf. • Basically the operations are done on the subtree of height k, which affects the whole tree of height 2^k, without touching the rest of the tree. And that’s why the time complexity of operations is O(loglogn) instead of O(logn).

  36. Conclusions • Comparisons

  37. Conclusions(Cont’d) • Advantages • Efficient PQ to work with VERY large amounts of data • Disadvantages • VERY difficult to implement • Can’t be used for Real-Valued Priority Queues. • Space – uses a full tree just for leaves

  38. My Contributions • Research on Subject • Web • Periodicals • Books • LEDA • Reading Papers • UNDERSTANDING the Data Structure

  39. References • P.van Emde Boas, R.Kaas, E.Zulstra. Design and Implementation of an Efficient Priority Queue. Mathematical Systems Theory. 1977:vol10, pgs 99-127 • P.van Emde Boas. An O(nloglogn) Online Algorithm for the Insert/Extract Min Problem. 1974 • http://www.cs.mcgill.ca/~mwozni/cs251/welcome.html • LEDA • eb_tree.h • _eb_tree.c

More Related