A logarithmic implementation of flexible arrays
In this paper we derive an implementation of so-called flexible arrays; a flexible array is an array whose size can be changed by adding or removing elements at either end. By representing flexible arrays by so-called Braun trees, we are able to implement all array operations with logarithmic — in the size of the array—time complexity.
Braun trees can be conveniently defined in a recursive way. Therefore, we use functional programming to derive (recursive) definitions for the functions representing the array operations. Subsequently, we use these definitions to derive (iterative) sequential implementations.
KeywordsFunctional Program Proof Obligation Sequential Implementation Composite Tree Node Sharing
Unable to display preview. Download preview PDF.