Algorithms and data structures [chapter]

2015 Big Practical Guide to Computer Simulations  
Various computer hardware components are affecting the running time of algorithms in different proportions, or may have severe implications on the accuracy of algorithms. In this dissertation we propose algorithms and data structures that are efficient and robust with respect to different hardware factors. The hardware factors affecting the running time that we consider include branch mispredictions occurring in the processor, memory transfers occurring between consecutive levels of the memory
more » ... ierarchy in modern computers, as well as the high rate sequential access on modern hard-disks which is a major motivation for developing streaming algorithms. Regarding the factors affecting the accuracy of algorithms, we consider soft memory errors which determine corruptions in RAM memories. Branch mispredictions incur significant performance losses for algorithms. First, we show that the running time of randomized Quicksort is adaptive, i.e. it depends on the presortedness of the input. We prove theoretically that the number of element swaps performed by Quicksort depends on the number Inv of inversions in the input and show experimentally that the number of element swaps is closely correlated to the number of branch mispredictions. We then give lower bound trade-offs between comparisons and branch mispredictions for sorting and adaptive sorting, and propose sorting and adaptive sorting algorithms matching these bounds. Finally, we show experimentally that for random queries perfectly balanced binary search trees can be outperformed by skewed binary search trees, i.e. trees for which at any given node there is a fixed ratio between the nodes in the left and right subtrees. This happens because the skewed binary search trees perform more comparisons, but fewer branch mispredictions, compared to perfectly binary search trees for random queries. Memory transfers occurring between consecutive levels of the memory hierarchy in modern computers are modeled in the I/O model and cache oblivious model, and the complexity of algorithms is given by the number of memory transfers performed. We introduce I/O lower bounds for adaptive sorting algorithms and give two algorithms that are optimal and I/O optimal with respect to Inv . In a streaming setting, algorithms are restricted to access data sequentially, while having at their disposal a working memory that can be accessed for free, but which is usually much smaller than the problem size. We give general reductions from parallel algorithms to streaming algorithms, and show that we can obtain optimal algorithms (up to poly-log factors) for several combinatorial problems, such as sorting, connected components, minimum spanning tree, v
doi:10.1142/9789814571784_0006 fatcat:i772srdlu5eq5eeoiqqytutg34