33 research outputs found
Generation, Ranking and Unranking of Ordered Trees with Degree Bounds
We study the problem of generating, ranking and unranking of unlabeled
ordered trees whose nodes have maximum degree of . This class of trees
represents a generalization of chemical trees. A chemical tree is an unlabeled
tree in which no node has degree greater than 4. By allowing up to
children for each node of chemical tree instead of 4, we will have a
generalization of chemical trees. Here, we introduce a new encoding over an
alphabet of size 4 for representing unlabeled ordered trees with maximum degree
of . We use this encoding for generating these trees in A-order with
constant average time and O(n) worst case time. Due to the given encoding, with
a precomputation of size and time O(n^2) (assuming is constant), both
ranking and unranking algorithms are also designed taking O(n) and O(nlogn)
time complexities.Comment: In Proceedings DCM 2015, arXiv:1603.0053
Counting and Generating Terms in the Binary Lambda Calculus (Extended version)
In a paper entitled Binary lambda calculus and combinatory logic, John Tromp
presents a simple way of encoding lambda calculus terms as binary sequences. In
what follows, we study the numbers of binary strings of a given size that
represent lambda terms and derive results from their generating functions,
especially that the number of terms of size n grows roughly like 1.963447954.
.. n. In a second part we use this approach to generate random lambda terms
using Boltzmann samplers.Comment: extended version of arXiv:1401.037
Boltzmann samplers for random generation of lambda terms
Randomly generating structured objects is important in testing and optimizing
functional programs, whereas generating random -terms is more specifically
needed for testing and optimizing compilers. For that a tool called QuickCheck
has been proposed, but in this tool the control of the random generation is
left to the programmer. Ten years ago, a method called Boltzmann samplers has
been proposed to generate combinatorial structures. In this paper, we show how
Boltzmann samplers can be developed to generate lambda-terms, but also other
data structures like trees. These samplers rely on a critical value which
parameters the main random selector and which is exhibited here with
explanations on how it is computed. Haskell programs are proposed to show how
samplers are actually implemented
New Combinatorial Properties and Algorithms for AVL Trees
In this thesis, new properties of AVL trees and a new partitioning of binary search trees named
core partitioning scheme are discussed, this scheme is applied to three binary search trees namely AVL trees, weight-balanced trees, and plain binary search trees.
We introduce the core partitioning scheme, which maintains a balanced search tree as a dynamic
collection of complete balanced binary trees called cores. Using this technique we achieve the same theoretical efficiency of modern cache-oblivious data structures by using classic data structures such as weight-balanced trees or height balanced trees (e.g. AVL trees). We preserve the original topology and algorithms of the given balanced search tree using a simple post-processing with guaranteed performance to completely rebuild the changed cores (possibly all of them) after each update. Using our core partitioning scheme, we simultaneously achieve good memory allocation, space-efficient representation, and cache-obliviousness. We also apply this scheme to arbitrary binary search trees which can be unbalanced and we produce a new data structure, called Cache-Oblivious General Balanced Tree (COG-tree).
Using our scheme, searching a key requires O(log_B n) block transfers and O(log n) comparisons
in the external-memory and in the cache-oblivious model. These complexities are theoretically efficient. Interestingly, the core partition for weight-balanced trees and COG-tree can be maintained with amortized O(log_B n) block transfers per update, whereas maintaining the core partition for AVL trees requires more than a poly-logarithmic amortized cost.
Studying the properties of these trees also lead us to some other new properties of AVL trees
and trees with bounded degree, namely, we present and study gaps in AVL trees and we prove Tarjan et al.'s conjecture on the number of rotations in a sequence of deletions and insertions