asymptotic enumeration of compacted binary trees with
play

Asymptotic Enumeration of Compacted Binary Trees with Height - PowerPoint PPT Presentation

Compacted Binary Trees Asymptotic Enumeration of Compacted Binary Trees with Height Restrictions CLA 05/2018 Michael Wallner joint work with Antoine Genitrini, Bernhard Gittenberger and Manuel Kauers Erwin Schr odinger-Fellow (Austrian


  1. Compacted Binary Trees | Creating a compacted tree Motivation – Efficiently store redundant information Example Consider the labeled tree necessary to store the arithmetic expression (* (- (* x x) (* y y)) (+ (* x x) (* y y))) which represents ( x 2 − y 2 )( x 2 + y 2 ). × 5 + 2 4 2 × 1 1 3 3 1 1 y y (1 , ( x , 0 , 0)), (2 , ( × , 1 , 1)), (3 , ( y , 0 , 0)), (4 , ( × , 3 , 3)), (5 , ( − , 2 , 4)) Michael Wallner | LaBRI | 24.05.2018 3 / 36

  2. Compacted Binary Trees | Creating a compacted tree Motivation – Efficiently store redundant information Example Consider the labeled tree necessary to store the arithmetic expression (* (- (* x x) (* y y)) (+ (* x x) (* y y))) which represents ( x 2 − y 2 )( x 2 + y 2 ). × 5 + 2 4 2 × 1 1 3 3 1 1 y y (1 , ( x , 0 , 0)), (2 , ( × , 1 , 1)), (3 , ( y , 0 , 0)), (4 , ( × , 3 , 3)), (5 , ( − , 2 , 4)) Michael Wallner | LaBRI | 24.05.2018 3 / 36

  3. Compacted Binary Trees | Creating a compacted tree Motivation – Efficiently store redundant information Example Consider the labeled tree necessary to store the arithmetic expression (* (- (* x x) (* y y)) (+ (* x x) (* y y))) which represents ( x 2 − y 2 )( x 2 + y 2 ). × 5 + 2 4 2 × 1 1 3 3 1 1 3 y (1 , ( x , 0 , 0)), (2 , ( × , 1 , 1)), (3 , ( y , 0 , 0)), (4 , ( × , 3 , 3)), (5 , ( − , 2 , 4)) Michael Wallner | LaBRI | 24.05.2018 3 / 36

  4. Compacted Binary Trees | Creating a compacted tree Motivation – Efficiently store redundant information Example Consider the labeled tree necessary to store the arithmetic expression (* (- (* x x) (* y y)) (+ (* x x) (* y y))) which represents ( x 2 − y 2 )( x 2 + y 2 ). × 5 + 2 4 2 × 1 1 3 3 1 1 3 y (1 , ( x , 0 , 0)), (2 , ( × , 1 , 1)), (3 , ( y , 0 , 0)), (4 , ( × , 3 , 3)), (5 , ( − , 2 , 4)) Michael Wallner | LaBRI | 24.05.2018 3 / 36

  5. Compacted Binary Trees | Creating a compacted tree Motivation – Efficiently store redundant information Example Consider the labeled tree necessary to store the arithmetic expression (* (- (* x x) (* y y)) (+ (* x x) (* y y))) which represents ( x 2 − y 2 )( x 2 + y 2 ). × 5 + 2 4 2 × 1 1 3 3 1 1 3 3 (1 , ( x , 0 , 0)), (2 , ( × , 1 , 1)), (3 , ( y , 0 , 0)), (4 , ( × , 3 , 3)), (5 , ( − , 2 , 4)) Michael Wallner | LaBRI | 24.05.2018 3 / 36

  6. Compacted Binary Trees | Creating a compacted tree Motivation – Efficiently store redundant information Example Consider the labeled tree necessary to store the arithmetic expression (* (- (* x x) (* y y)) (+ (* x x) (* y y))) which represents ( x 2 − y 2 )( x 2 + y 2 ). × 5 + 2 4 2 × 1 1 3 3 1 1 3 3 (1 , ( x , 0 , 0)), (2 , ( × , 1 , 1)), (3 , ( y , 0 , 0)), (4 , ( × , 3 , 3)), (5 , ( − , 2 , 4)) Michael Wallner | LaBRI | 24.05.2018 3 / 36

  7. Compacted Binary Trees | Creating a compacted tree Motivation – Efficiently store redundant information Example Consider the labeled tree necessary to store the arithmetic expression (* (- (* x x) (* y y)) (+ (* x x) (* y y))) which represents ( x 2 − y 2 )( x 2 + y 2 ). × 5 + 2 4 2 4 1 1 3 3 1 1 3 3 (1 , ( x , 0 , 0)), (2 , ( × , 1 , 1)), (3 , ( y , 0 , 0)), (4 , ( × , 3 , 3)), (5 , ( − , 2 , 4)) Michael Wallner | LaBRI | 24.05.2018 3 / 36

  8. Compacted Binary Trees | Creating a compacted tree Motivation – Efficiently store redundant information Example Consider the labeled tree necessary to store the arithmetic expression (* (- (* x x) (* y y)) (+ (* x x) (* y y))) which represents ( x 2 − y 2 )( x 2 + y 2 ). × 5 + 2 4 2 4 1 1 3 3 1 1 3 3 (1 , ( x , 0 , 0)), (2 , ( × , 1 , 1)), (3 , ( y , 0 , 0)), (4 , ( × , 3 , 3)), (5 , ( − , 2 , 4)) Michael Wallner | LaBRI | 24.05.2018 3 / 36

  9. Compacted Binary Trees | Creating a compacted tree Motivation – Efficiently store redundant information Example Consider the labeled tree necessary to store the arithmetic expression (* (- (* x x) (* y y)) (+ (* x x) (* y y))) which represents ( x 2 − y 2 )( x 2 + y 2 ). × 5 6 2 4 2 4 1 1 3 3 1 1 3 3 (1 , ( x , 0 , 0)), (2 , ( × , 1 , 1)), (3 , ( y , 0 , 0)), (4 , ( × , 3 , 3)), (5 , ( − , 2 , 4)), (6 , ( − , 2 , 4)) Michael Wallner | LaBRI | 24.05.2018 3 / 36

  10. Compacted Binary Trees | Creating a compacted tree Motivation – Efficiently store redundant information Example Consider the labeled tree necessary to store the arithmetic expression (* (- (* x x) (* y y)) (+ (* x x) (* y y))) which represents ( x 2 − y 2 )( x 2 + y 2 ). × 5 6 2 4 2 4 1 1 3 3 1 1 3 3 (1 , ( x , 0 , 0)), (2 , ( × , 1 , 1)), (3 , ( y , 0 , 0)), (4 , ( × , 3 , 3)), (5 , ( − , 2 , 4)), (6 , ( − , 2 , 4)) Michael Wallner | LaBRI | 24.05.2018 3 / 36

  11. Compacted Binary Trees | Creating a compacted tree Motivation – Efficiently store redundant information Example Consider the labeled tree necessary to store the arithmetic expression (* (- (* x x) (* y y)) (+ (* x x) (* y y))) which represents ( x 2 − y 2 )( x 2 + y 2 ). 7 5 6 2 4 2 4 1 1 3 3 1 1 3 3 (1 , ( x , 0 , 0)), (2 , ( × , 1 , 1)), (3 , ( y , 0 , 0)), (4 , ( × , 3 , 3)), (5 , ( − , 2 , 4)), (6 , ( − , 2 , 4)), (7 , ( − , 5 , 6)) Michael Wallner | LaBRI | 24.05.2018 3 / 36

  12. Compacted Binary Trees | Creating a compacted tree Motivation – Efficiently store redundant information Example Consider the labeled tree necessary to store the arithmetic expression (* (- (* x x) (* y y)) (+ (* x x) (* y y))) which represents ( x 2 − y 2 )( x 2 + y 2 ). 7 × 5 6 − + 2 4 2 4 × × 1 1 3 3 1 1 3 3 x y (1 , ( x , 0 , 0)), (2 , ( × , 1 , 1)), (3 , ( y , 0 , 0)), (4 , ( × , 3 , 3)), (5 , ( − , 2 , 4)), (6 , ( − , 2 , 4)), (7 , ( − , 5 , 6)) Michael Wallner | LaBRI | 24.05.2018 3 / 36

  13. Compacted Binary Trees | Creating a compacted tree Motivation – Efficiently store redundant information Example Consider the labeled tree necessary to store the arithmetic expression (* (- (* x x) (* y y)) (+ (* x x) (* y y))) which represents ( x 2 − y 2 )( x 2 + y 2 ). 7 × 5 6 − + 2 4 2 4 × × 1 1 3 3 1 1 3 3 x y (1 , ( x , 0 , 0)), (2 , ( × , 1 , 1)), (3 , ( y , 0 , 0)), (4 , ( × , 3 , 3)), (5 , ( − , 2 , 4)), (6 , ( − , 2 , 4)), (7 , ( − , 5 , 6)) Definition Compacted tree is the DAG computed by this procedure. Michael Wallner | LaBRI | 24.05.2018 3 / 36

  14. Compacted Binary Trees | Creating a compacted tree Compacted trees Important property: Subtrees are unique Efficient algorithm to compute compacted tree Traverse tree post-order If subtree appears twice, delete second one and replace by pointer → directed acyclic graph (DAG) Analyzed by [Flajolet, Sipala, Steyaert 1990]: A tree of size n has a compacted form of expected size that is asymptotically equal to n C √ log n , where C is explicit related to the type of trees and the statistical model. Applications: XML-Compression [Bousquet-M´ elou, Lohrey, Maneth, Noeth 2015], Compilers [Aho, Sethi, Ullman 1986], LISP [Goto 1974], Data storage [Meinel, Theobald 1998], [Knuth 1968], etc. Restrict to unlabeled binary trees Michael Wallner | LaBRI | 24.05.2018 4 / 36

  15. Compacted Binary Trees | Creating a compacted tree Compacted trees Important property: Subtrees are unique Efficient algorithm to compute compacted tree Traverse tree post-order If subtree appears twice, delete second one and replace by pointer → directed acyclic graph (DAG) Analyzed by [Flajolet, Sipala, Steyaert 1990]: A tree of size n has a compacted form of expected size that is asymptotically equal to n C √ log n , where C is explicit related to the type of trees and the statistical model. Applications: XML-Compression [Bousquet-M´ elou, Lohrey, Maneth, Noeth 2015], Compilers [Aho, Sethi, Ullman 1986], LISP [Goto 1974], Data storage [Meinel, Theobald 1998], [Knuth 1968], etc. Restrict to unlabeled binary trees Michael Wallner | LaBRI | 24.05.2018 4 / 36

  16. Compacted Binary Trees | Creating a compacted tree Compacted trees Important property: Subtrees are unique Efficient algorithm to compute compacted tree Traverse tree post-order If subtree appears twice, delete second one and replace by pointer → directed acyclic graph (DAG) Analyzed by [Flajolet, Sipala, Steyaert 1990]: A tree of size n has a compacted form of expected size that is asymptotically equal to n C √ log n , where C is explicit related to the type of trees and the statistical model. Applications: XML-Compression [Bousquet-M´ elou, Lohrey, Maneth, Noeth 2015], Compilers [Aho, Sethi, Ullman 1986], LISP [Goto 1974], Data storage [Meinel, Theobald 1998], [Knuth 1968], etc. Restrict to unlabeled binary trees Michael Wallner | LaBRI | 24.05.2018 4 / 36

  17. Compacted Binary Trees | Creating a compacted tree Compacted trees Important property: Subtrees are unique Efficient algorithm to compute compacted tree Traverse tree post-order If subtree appears twice, delete second one and replace by pointer → directed acyclic graph (DAG) Analyzed by [Flajolet, Sipala, Steyaert 1990]: A tree of size n has a compacted form of expected size that is asymptotically equal to n C √ log n , where C is explicit related to the type of trees and the statistical model. Applications: XML-Compression [Bousquet-M´ elou, Lohrey, Maneth, Noeth 2015], Compilers [Aho, Sethi, Ullman 1986], LISP [Goto 1974], Data storage [Meinel, Theobald 1998], [Knuth 1968], etc. Restrict to unlabeled binary trees Michael Wallner | LaBRI | 24.05.2018 4 / 36

  18. Compacted Binary Trees | Creating a compacted tree Compacted trees Important property: Subtrees are unique Efficient algorithm to compute compacted tree Traverse tree post-order If subtree appears twice, delete second one and replace by pointer → directed acyclic graph (DAG) Analyzed by [Flajolet, Sipala, Steyaert 1990]: A tree of size n has a compacted form of expected size that is asymptotically equal to n C √ log n , where C is explicit related to the type of trees and the statistical model. Applications: XML-Compression [Bousquet-M´ elou, Lohrey, Maneth, Noeth 2015], Compilers [Aho, Sethi, Ullman 1986], LISP [Goto 1974], Data storage [Meinel, Theobald 1998], [Knuth 1968], etc. Restrict to unlabeled binary trees Michael Wallner | LaBRI | 24.05.2018 4 / 36

  19. Compacted Binary Trees | Creating a compacted tree Compacted trees Important property: Subtrees are unique Efficient algorithm to compute compacted tree Traverse tree post-order If subtree appears twice, delete second one and replace by pointer → directed acyclic graph (DAG) Analyzed by [Flajolet, Sipala, Steyaert 1990]: A tree of size n has a compacted form of expected size that is asymptotically equal to n C √ log n , where C is explicit related to the type of trees and the statistical model. Applications: XML-Compression [Bousquet-M´ elou, Lohrey, Maneth, Noeth 2015], Compilers [Aho, Sethi, Ullman 1986], LISP [Goto 1974], Data storage [Meinel, Theobald 1998], [Knuth 1968], etc. Restrict to unlabeled binary trees Reverse question How many compacted trees of (compacted) size n exist? Michael Wallner | LaBRI | 24.05.2018 4 / 36

  20. Compacted Binary Trees | Creating a compacted tree Compacted trees Size of a compacted tree: number of internal nodes Number of compacted trees of size n : c n Michael Wallner | LaBRI | 24.05.2018 5 / 36

  21. Compacted Binary Trees | Creating a compacted tree Compacted trees Size of a compacted tree: number of internal nodes Number of compacted trees of size n : c n Michael Wallner | LaBRI | 24.05.2018 5 / 36

  22. Compacted Binary Trees | Creating a compacted tree Compacted trees Size of a compacted tree: number of internal nodes Number of compacted trees of size n : c n Figure: All compacted binary trees of size n = 0 , 1 , 2. Michael Wallner | LaBRI | 24.05.2018 5 / 36

  23. Compacted Binary Trees | Creating a compacted tree Compacted trees Size of a compacted tree: number of internal nodes Number of compacted trees of size n : c n Figure: All compacted binary trees of size n = 0 , 1 , 2. Example (Compacted binary trees) size n = 0 n = 1 n = 2 n = 3 n = 4 n = 5 n = 6 c n 1 1 3 15 111 1119 14487 � 2 n � 1 n ! ≤ c n ≤ · n ! n + 1 n Hence, c n = O ( n !4 n n − 1 / 2 ). Michael Wallner | LaBRI | 24.05.2018 5 / 36

  24. Compacted Binary Trees | Creating a compacted tree Goals of this talk Goals 1 Understand compacted trees 2 Find a recurrence relation for compacted trees 3 Use exponential generating functions to count DAGs 4 Solve the (simplified) problem(s) Michael Wallner | LaBRI | 24.05.2018 6 / 36

  25. Compacted Binary Trees | Creating a compacted tree Goals of this talk Goals 1 Understand compacted trees 2 Find a recurrence relation for compacted trees 3 Use exponential generating functions to count DAGs 4 Solve the (simplified) problem(s) Michael Wallner | LaBRI | 24.05.2018 6 / 36

  26. Compacted Binary Trees | Creating a compacted tree Goals of this talk Goals 1 Understand compacted trees 2 Find a recurrence relation for compacted trees 3 Use exponential generating functions to count DAGs 4 Solve the (simplified) problem(s) Michael Wallner | LaBRI | 24.05.2018 6 / 36

  27. Compacted Binary Trees | Creating a compacted tree Goals of this talk Goals 1 Understand compacted trees 2 Find a recurrence relation for compacted trees 3 Use exponential generating functions to count DAGs 4 Solve the (simplified) problem(s) Michael Wallner | LaBRI | 24.05.2018 6 / 36

  28. Compacted Binary Trees | Creating a compacted tree Goals of this talk Goals 1 Understand compacted trees 2 Find a recurrence relation for compacted trees 3 Use exponential generating functions to count DAGs 4 Solve the (simplified) problem(s) Methods 1 Recurrence relations 5 Differential equations 2 Bijections 6 Singularity analysis 3 Generating functions 7 Chebyshev polynomials 4 Symbolic method 8 Guess and prove Michael Wallner | LaBRI | 24.05.2018 6 / 36

  29. Compacted Binary Trees | Creating a compacted tree Building a compacted tree from a binary tree Idea Every compacted tree of size n can be build from a binary tree of size n by adding pointers. Michael Wallner | LaBRI | 24.05.2018 7 / 36

  30. Compacted Binary Trees | Creating a compacted tree Building a compacted tree from a binary tree Idea Every compacted tree of size n can be build from a binary tree of size n by adding pointers. Attention: Pointers are not allowed to violate uniqueness Observation: Only cherries (nodes with 2 pointers) might violate uniqueness Michael Wallner | LaBRI | 24.05.2018 7 / 36

  31. Compacted Binary Trees | Creating a compacted tree Building a compacted tree from a binary tree Idea Every compacted tree of size n can be build from a binary tree of size n by adding pointers. Attention: Pointers are not allowed to violate uniqueness Observation: Only cherries (nodes with 2 pointers) might violate uniqueness Michael Wallner | LaBRI | 24.05.2018 7 / 36

  32. Compacted Binary Trees | Creating a compacted tree Building a compacted tree from a binary tree Idea Every compacted tree of size n can be build from a binary tree of size n by adding pointers. Attention: Pointers are not allowed to violate uniqueness Observation: Only cherries (nodes with 2 pointers) might violate uniqueness Procedure 1 Take a binary tree of size n 2 Add leaf as left child on first free spot in post-order traversal 3 Add pointers such that out-degree of all internal nodes is 2 4 Connect pointers to leaf or to internal nodes before the root in post-order NOT violating uniqueness Michael Wallner | LaBRI | 24.05.2018 7 / 36

  33. Compacted Binary Trees | Creating a compacted tree Building a compacted tree from a binary tree Idea Every compacted tree of size n can be build from a binary tree of size n by adding pointers. Attention: Pointers are not allowed to violate uniqueness Observation: Only cherries (nodes with 2 pointers) might violate uniqueness Procedure 1 Take a binary tree of size n 2 Add leaf as left child on first free spot in post-order traversal 3 Add pointers such that out-degree of all internal nodes is 2 4 Connect pointers to leaf or to internal nodes before the root in post-order NOT violating uniqueness Michael Wallner | LaBRI | 24.05.2018 7 / 36

  34. Compacted Binary Trees | Creating a compacted tree Building a compacted tree from a binary tree Idea Every compacted tree of size n can be build from a binary tree of size n by adding pointers. Attention: Pointers are not allowed to violate uniqueness Observation: Only cherries (nodes with 2 pointers) might violate uniqueness Procedure 1 Take a binary tree of size n 2 Add leaf as left child on first free spot in post-order traversal 3 Add pointers such that out-degree of all internal nodes is 2 4 Connect pointers to leaf or to internal nodes before the root in post-order NOT violating uniqueness Michael Wallner | LaBRI | 24.05.2018 7 / 36

  35. Compacted Binary Trees | Creating a compacted tree Building a compacted tree from a binary tree Idea Every compacted tree of size n can be build from a binary tree of size n by adding pointers. Attention: Pointers are not allowed to violate uniqueness Observation: Only cherries (nodes with 2 pointers) might violate uniqueness Procedure 1 Take a binary tree of size n 2 Add leaf as left child on first free spot in post-order traversal 3 Add pointers such that out-degree of all internal nodes is 2 4 Connect pointers to leaf or to internal nodes before the root in post-order NOT violating uniqueness Michael Wallner | LaBRI | 24.05.2018 7 / 36

  36. Compacted Binary Trees | Creating a compacted tree Building a compacted tree from a binary tree – Example Procedure 1 Take a binary tree of size n (called spine ) 2 Add leaf as left child on first free spot in post-order traversal 3 Add pointers such that out-degree of all internal nodes is 2 4 Connect pointers to leaf or to internal nodes before the root in post-order NOT violating uniqueness Michael Wallner | LaBRI | 24.05.2018 8 / 36

  37. Compacted Binary Trees | Creating a compacted tree Building a compacted tree from a binary tree – Example Procedure 1 Take a binary tree of size n (called spine ) 2 Add leaf as left child on first free spot in post-order traversal 3 Add pointers such that out-degree of all internal nodes is 2 4 Connect pointers to leaf or to internal nodes before the root in post-order NOT violating uniqueness Michael Wallner | LaBRI | 24.05.2018 8 / 36

  38. Compacted Binary Trees | Creating a compacted tree Building a compacted tree from a binary tree – Example Procedure 1 Take a binary tree of size n (called spine ) 2 Add leaf as left child on first free spot in post-order traversal 3 Add pointers such that out-degree of all internal nodes is 2 4 Connect pointers to leaf or to internal nodes before the root in post-order NOT violating uniqueness Michael Wallner | LaBRI | 24.05.2018 8 / 36

  39. Compacted Binary Trees | Creating a compacted tree Building a compacted tree from a binary tree – Example Procedure 1 Take a binary tree of size n (called spine ) 2 Add leaf as left child on first free spot in post-order traversal 3 Add pointers such that out-degree of all internal nodes is 2 4 Connect pointers to leaf or to internal nodes before the root in post-order NOT violating uniqueness Michael Wallner | LaBRI | 24.05.2018 8 / 36

  40. Compacted Binary Trees | Creating a compacted tree Building a compacted tree from a binary tree – Example Procedure 1 Take a binary tree of size n (called spine ) 2 Add leaf as left child on first free spot in post-order traversal 3 Add pointers such that out-degree of all internal nodes is 2 4 Connect pointers to leaf or to internal nodes before the root in post-order NOT violating uniqueness Michael Wallner | LaBRI | 24.05.2018 8 / 36

  41. Compacted Binary Trees | Creating a compacted tree Building a compacted tree from a binary tree – Example Procedure 1 Take a binary tree of size n (called spine ) 2 Add leaf as left child on first free spot in post-order traversal 3 Add pointers such that out-degree of all internal nodes is 2 4 Connect pointers to leaf or to internal nodes before the root in post-order NOT violating uniqueness Valid compacted tree Michael Wallner | LaBRI | 24.05.2018 8 / 36

  42. Compacted Binary Trees | Creating a compacted tree Building a compacted tree from a binary tree – Example Procedure 1 Take a binary tree of size n (called spine ) 2 Add leaf as left child on first free spot in post-order traversal 3 Add pointers such that out-degree of all internal nodes is 2 4 Connect pointers to leaf or to internal nodes before the root in post-order NOT violating uniqueness Valid compacted tree Michael Wallner | LaBRI | 24.05.2018 8 / 36

  43. Compacted Binary Trees | Creating a compacted tree Building a compacted tree from a binary tree – Example Procedure 1 Take a binary tree of size n (called spine ) 2 Add leaf as left child on first free spot in post-order traversal 3 Add pointers such that out-degree of all internal nodes is 2 4 Connect pointers to leaf or to internal nodes before the root in post-order NOT violating uniqueness Valid compacted tree Michael Wallner | LaBRI | 24.05.2018 8 / 36

  44. Compacted Binary Trees | Creating a compacted tree Building a compacted tree from a binary tree – Example Procedure 1 Take a binary tree of size n (called spine ) 2 Add leaf as left child on first free spot in post-order traversal 3 Add pointers such that out-degree of all internal nodes is 2 4 Connect pointers to leaf or to internal nodes before the root in post-order NOT violating uniqueness Valid compacted tree Michael Wallner | LaBRI | 24.05.2018 8 / 36

  45. Compacted Binary Trees | Creating a compacted tree Building a compacted tree from a binary tree – Example Procedure 1 Take a binary tree of size n (called spine ) 2 Add leaf as left child on first free spot in post-order traversal 3 Add pointers such that out-degree of all internal nodes is 2 4 Connect pointers to leaf or to internal nodes before the root in post-order NOT violating uniqueness Valid compacted tree Michael Wallner | LaBRI | 24.05.2018 8 / 36

  46. Compacted Binary Trees | Creating a compacted tree Building a compacted tree from a binary tree – Example Procedure 1 Take a binary tree of size n (called spine ) 2 Add leaf as left child on first free spot in post-order traversal 3 Add pointers such that out-degree of all internal nodes is 2 4 Connect pointers to leaf or to internal nodes before the root in post-order NOT violating uniqueness Valid compacted tree Invalid compacted tree Michael Wallner | LaBRI | 24.05.2018 8 / 36

  47. Compacted Binary Trees | Creating a compacted tree Building a compacted tree from a binary tree – Example Procedure 1 Take a binary tree of size n (called spine ) 2 Add leaf as left child on first free spot in post-order traversal 3 Add pointers such that out-degree of all internal nodes is 2 4 Connect pointers to leaf or to internal nodes before the root in post-order NOT violating uniqueness Valid compacted tree Invalid compacted tree We call the underlying binary tree from step 1 the spine . Michael Wallner | LaBRI | 24.05.2018 8 / 36

  48. Compacted Binary Trees | Creating a compacted tree Building a compacted tree from a binary tree – Example Procedure 1 Take a binary tree of size n (called spine ) 2 Add leaf as left child on first free spot in post-order traversal 3 Add pointers such that out-degree of all internal nodes is 2 4 Connect pointers to leaf or to internal nodes before the root in post-order NOT violating uniqueness Valid compacted tree Invalid compacted tree We call the underlying binary tree from step 1 the spine . This spine is associated to 3 valid compacted trees. Michael Wallner | LaBRI | 24.05.2018 8 / 36

  49. Compacted Binary Trees | Creating a compacted tree A bigger example We take a binary tree of size 8. Michael Wallner | LaBRI | 24.05.2018 9 / 36

  50. Compacted Binary Trees | Creating a compacted tree A bigger example We take a binary tree of size 8. Michael Wallner | LaBRI | 24.05.2018 9 / 36

  51. Compacted Binary Trees | Creating a compacted tree A bigger example We take a binary tree of size 8. 1 Michael Wallner | LaBRI | 24.05.2018 9 / 36

  52. Compacted Binary Trees | Creating a compacted tree A bigger example We take a binary tree of size 8. 1 2 2 Michael Wallner | LaBRI | 24.05.2018 9 / 36

  53. Compacted Binary Trees | Creating a compacted tree A bigger example We take a binary tree of size 8. 1 3 2 2 Michael Wallner | LaBRI | 24.05.2018 9 / 36

  54. Compacted Binary Trees | Creating a compacted tree A bigger example We take a binary tree of size 8. 1 3 4 2 2 Michael Wallner | LaBRI | 24.05.2018 9 / 36

  55. Compacted Binary Trees | Creating a compacted tree A bigger example We take a binary tree of size 8. 1 3 4 2 2 4 4 Michael Wallner | LaBRI | 24.05.2018 9 / 36

  56. Compacted Binary Trees | Creating a compacted tree A bigger example We take a binary tree of size 8. 1 3 4 2 2 13 4 4 Michael Wallner | LaBRI | 24.05.2018 9 / 36

  57. Compacted Binary Trees | Creating a compacted tree A bigger example We take a binary tree of size 8. 1 3 4 6 6 2 2 13 4 4 Michael Wallner | LaBRI | 24.05.2018 9 / 36

  58. Compacted Binary Trees | Creating a compacted tree A bigger example We take a binary tree of size 8. 31 1 3 4 6 6 2 2 13 4 4 Michael Wallner | LaBRI | 24.05.2018 9 / 36

  59. Compacted Binary Trees | Creating a compacted tree A bigger example We take a binary tree of size 8. 31 1 3 4 6 6 2 2 13 4 4 In total, this spine corresponds to 1 · 3 · 4 · 13 · 31 = 4836 compacted trees. Michael Wallner | LaBRI | 24.05.2018 9 / 36

  60. Compacted Binary Trees | A recurrence relation A recurrence relation Michael Wallner | LaBRI | 24.05.2018 10 / 36

  61. Compacted Binary Trees | A recurrence relation A recurrence for compacted binary trees Counting formula Let n , p ∈ N , then n � γ n +1 , p = for n ≥ 1 , γ i , p γ n − i , p + i , i =0 Helps us to efficiently compute c n Asymptotic analysis failed (so far) One reason: asymptotically every summand matters Summands possess 3 (!) dependencies on i Michael Wallner | LaBRI | 24.05.2018 11 / 36

  62. Compacted Binary Trees | A recurrence relation A recurrence for compacted binary trees Counting formula Let n , p ∈ N , then n � γ n +1 , p = for n ≥ 1 , γ i , p γ n − i , p + i , i =0 γ 0 , p = p + 1 , Helps us to efficiently compute c n Asymptotic analysis failed (so far) One reason: asymptotically every summand matters Summands possess 3 (!) dependencies on i Michael Wallner | LaBRI | 24.05.2018 11 / 36

  63. Compacted Binary Trees | A recurrence relation A recurrence for compacted binary trees Counting formula Let n , p ∈ N , then n � γ n +1 , p = for n ≥ 1 , γ i , p γ n − i , p + i , i =0 γ 0 , p = p + 1 , γ 1 , p = p 2 + p + 1 . Helps us to efficiently compute c n Asymptotic analysis failed (so far) One reason: asymptotically every summand matters Summands possess 3 (!) dependencies on i Michael Wallner | LaBRI | 24.05.2018 11 / 36

  64. Compacted Binary Trees | A recurrence relation A recurrence for compacted binary trees Counting formula Let n , p ∈ N , then n � γ n +1 , p = for n ≥ 1 , γ i , p γ n − i , p + i , i =0 γ 0 , p = p + 1 , γ 1 , p = p 2 + p + 1 . We are interested in c n = γ n , 0 . Helps us to efficiently compute c n Asymptotic analysis failed (so far) One reason: asymptotically every summand matters Summands possess 3 (!) dependencies on i Michael Wallner | LaBRI | 24.05.2018 11 / 36

  65. Compacted Binary Trees | A recurrence relation A recurrence for compacted binary trees Counting formula Let n , p ∈ N , then n � γ n +1 , p = for n ≥ 1 , γ i , p γ n − i , p + i , i =0 γ 0 , p = p + 1 , γ 1 , p = p 2 + p + 1 . We are interested in c n = γ n , 0 . Helps us to efficiently compute c n Asymptotic analysis failed (so far) One reason: asymptotically every summand matters Summands possess 3 (!) dependencies on i Michael Wallner | LaBRI | 24.05.2018 11 / 36

  66. Compacted Binary Trees | A recurrence relation A recurrence for compacted binary trees Counting formula Let n , p ∈ N , then n � γ n +1 , p = for n ≥ 1 , γ i , p γ n − i , p + i , i =0 γ 0 , p = p + 1 , γ 1 , p = p 2 + p + 1 . We are interested in c n = γ n , 0 . Helps us to efficiently compute c n Asymptotic analysis failed (so far) One reason: asymptotically every summand matters Summands possess 3 (!) dependencies on i Michael Wallner | LaBRI | 24.05.2018 11 / 36

  67. Compacted Binary Trees | A recurrence relation A recurrence for compacted binary trees Counting formula Let n , p ∈ N , then n � γ n +1 , p = for n ≥ 1 , γ i , p γ n − i , p + i , i =0 γ 0 , p = p + 1 , γ 1 , p = p 2 + p + 1 . We are interested in c n = γ n , 0 . Helps us to efficiently compute c n Asymptotic analysis failed (so far) One reason: asymptotically every summand matters Summands possess 3 (!) dependencies on i Michael Wallner | LaBRI | 24.05.2018 11 / 36

  68. Compacted Binary Trees | A recurrence relation Relaxed compacted binary trees Drop the condition of uniqueness of the subtrees, i.e. c n ≤ r n . Michael Wallner | LaBRI | 24.05.2018 12 / 36

  69. Compacted Binary Trees | A recurrence relation Relaxed compacted binary trees Drop the condition of uniqueness of the subtrees, i.e. c n ≤ r n . 1 4 6 6 2 2 4 4 Michael Wallner | LaBRI | 24.05.2018 12 / 36

  70. Compacted Binary Trees | A recurrence relation Relaxed compacted binary trees Drop the condition of uniqueness of the subtrees, i.e. c n ≤ r n . 1 4 6 6 2 2 4 4 In total, this spine corresponds to 1 · 3 · 4 · 4 2 · 6 2 = 6912 relaxed trees. (Recall, that the same spine corresponds to 4836 compacted trees.) Michael Wallner | LaBRI | 24.05.2018 12 / 36

  71. Compacted Binary Trees | A recurrence relation Relaxed compacted binary trees of size 3 Michael Wallner | LaBRI | 24.05.2018 13 / 36

  72. Compacted Binary Trees | A recurrence relation Relaxed compacted binary trees of size 3 The relaxed tree of size 3 which is not a compacted tree compacted tree binary tree relaxed tree Reason: subtrees not unique Michael Wallner | LaBRI | 24.05.2018 13 / 36

  73. Compacted Binary Trees | A recurrence relation A recurrence for relaxed compacted binary trees Counting formula Let n , p ∈ N , then n � δ n +1 , p = δ i , p δ n − i , p + i , for n ≥ 0 , i =0 δ 1 , p = p 2 + p + 1 . ❤❤❤❤❤❤❤ ✭ ✭✭✭✭✭✭✭ δ 0 , p = p + 1 , ❤ We are interested in r n = δ n , 0 . Michael Wallner | LaBRI | 24.05.2018 14 / 36

  74. Compacted Binary Trees | A recurrence relation A recurrence for relaxed compacted binary trees Counting formula Let n , p ∈ N , then n � δ n +1 , p = δ i , p δ n − i , p + i , for n ≥ 0 , i =0 δ 1 , p = p 2 + p + 1 . ❤❤❤❤❤❤❤ ✭ ✭✭✭✭✭✭✭ δ 0 , p = p + 1 , ❤ We are interested in r n = δ n , 0 . Recursion still too complicated. Michael Wallner | LaBRI | 24.05.2018 14 / 36

  75. Compacted Binary Trees | A recurrence relation A recurrence for relaxed compacted binary trees Counting formula Let n , p ∈ N , then n � δ n +1 , p = δ i , p δ n − i , p + i , for n ≥ 0 , i =0 δ 1 , p = p 2 + p + 1 . ❤❤❤❤❤❤❤ ✭ ✭✭✭✭✭✭✭ δ 0 , p = p + 1 , ❤ We are interested in r n = δ n , 0 . Recursion still too complicated. Example (Relaxed binary trees) size n = 0 n = 1 n = 2 n = 3 n = 4 n = 5 n = 6 1 1 3 15 111 1119 14487 c n r n 1 1 3 16 127 1363 18628 Michael Wallner | LaBRI | 24.05.2018 14 / 36

  76. Compacted Binary Trees | Operations on trees Operations on trees Michael Wallner | LaBRI | 24.05.2018 15 / 36

  77. Compacted Binary Trees | Operations on trees Bounded right height We restrict to a subclass of relaxed binary trees: bounded right height . Michael Wallner | LaBRI | 24.05.2018 16 / 36

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend