Abstract:
|
Los quad trees propuestos por Bentley en el 1974 son una estructura de datos diseñada para resolver búsquedas asociativas. Esta estructura es una generalización de los árboles binarios de búsqueda y es interesante porque es clásica y es utilizada. Además, es una estructura de datos jerárquica de propósito general que puede ser generalizada fácilmente a múltiples dimensiones. El problema de los quad trees es que es difícil borrar elementos o, dicho de otra manera, que sean dinámicos. Pese a que el borrado en dos dimensiones está definido por H. Samet, el algoritmo es complicado y difícil de implementar. Es más, este algoritmo también es difícil de generalizar para dimensiones mayores a 2. Además, en el algoritmo clásico de inserción, la forma del árbol depende del orden en el que se insertan las llaves. Si las llaves son generadas de manera independiente por una distribución de probabilidad continua, se obtiene un árbol aleatorio cuya altura esperada es logarítmica con respecto al número de llaves del árbol, sin embargo, si las llaves se insertan en orden, la altura del árbol es lineal, lo que tiene un impacto en la eficiencia de las búsquedas exactas en dicho árbol (que en el caso peor son de coste proporcional a la altura del árbol) y también en el de las búsquedas asociativas. En el artículo, Randomized insertion and deletion in point quad trees, se propone, utilizando algoritmos aleatorios, un algoritmo de borrado simple y escalable a más dimensiones. El algoritmo es fácil de describir y de generalizar y es bastante más sencillo de implementar que el de Samet. Además, los algoritmos de inserción y borrado en randomized quad trees garantizan que los quad trees resultantes sean siempre aleatorios. En este trabajo final de grado se estudian los algoritmos randomizados propuestos en el artículo citado anteriormente, se implementan y se propone una implementación alternativa y más eficiente que la original. Finalmente, se analiza experimental y exhaustivamente la eficiencia de los algoritmos de inserción y borrado propuestos. Posteriormente se comparan los resultados con algoritmos alternativos; una implementación con cola de prioridad y una implementación sin randomizar. Los resultados experimentales muestran que los algoritmos randomizados propuestos: 1) funcionan correctamente para cualquier dimensión (de hecho se han probado hasta dimensión 6, pero los algoritmos son válidos para cualquier dimensión, especialmente el borrado), 2) producen árboles aleatorios que cumplen con los costes esperados dados en la literatura, 3) compiten en eficiencia con la implementación con cola de prioridad propuesta especialmente para dimensiones menores de 5, y 4) compiten en eficiencia (son mucho mejores) que el algoritmo de inserción clásico en el caso en el que las llaves a insertar no sean aleatorias o estén dadas en orden. De hecho, este último algoritmo no produce árboles aleatorios cuando las llaves no son generadas de manera aleatoria. |
Abstract:
|
The quad trees proposed by Bentley in 1974 are a data structure designed to solve associative queries. This structure is a generalization of binary search trees and is interesting because it is classical and it is used. In addition, it is a general-purpose hierarchical data structure that can easily be generalized to multiple dimensions. The problem with quad trees is that it is difficult to delete elements, or in other words, to be dynamic. Although the two-dimensional deletion is defined by H. Samet, the algorithm is complicated and difficult to implement. Moreover, this algorithm is also difficult to generalize for dimensions greater than 2. In addition, in the classic algorithm of insertion, the shape of the tree depends on the order in which the keys are inserted, if the keys are generated independently by a continuous probability distribution, a random tree is obtained, whose expected height is logarithmic in regard to the number of keys of the tree, however, if the keys are inserted in order, the height of the tree is linear, which has an impact on the efficiency of the exact searches in said tree ( which in worst case their cost is proportional to the height of the tree) and also in the associative queries. In the article, Randomized insertion and deletion in point quad trees, it is proposed, using random algorithms, a simple and scalable deletion algorithm for more dimensions. The algorithm is easy to describe and generalize and is much simpler to implement than the Samet algorithm. In addition, the insertion and deletion algorithms in randomized quad trees guarantee that the resulting quad trees are always random. In this final degree project, the randomized algorithms proposed in the aforementioned article are studied and implemented, and an alternative and more efficient implementation than the original one is proposed. Finally, the efficiency of the proposed insertion and deletion algorithms is experimentally and exhaustively analysed. Subsequently, the results are compared with alternative algorithms; an implementation with priority queue and an implementation without randomization. The experimental results show that the proposed randomized algorithms: 1) work correctly for any dimension (in fact they have been tested up to dimension 6, but the algorithms are valid for any dimension, especially the deletion), 2) produce random trees that meet the costs expected in the literature, 3) compete in efficiency with the implementation with priority queue proposed especially for dimensions less than 5, and 4) compete in efficiency (are much better) than the classical insertion algorithm in the case where the keys to be inserted are not random or are given in order. In fact, this last algorithm does not produce random trees when the keys are not generated randomly. |