I wish to pass a 2 dimensional array to use in a back-tracking
algorithm. Since I will be doing lots of inserts, a Data.Array is
unsuitable. It seems that a Map Int (Map Int a) is the most suitable
structure, but this seems cumbersome.
Is there anything more appropriate?
--
Tony Morris
At 12:25 PM +1000 12/4/06, Tony Morris wrote:
I wish to pass a 2 dimensional array to use in a back-tracking
algorithm. Since I will be doing lots of inserts, a Data.Array is
unsuitable. It seems that a Map Int (Map Int a) is the most suitable
structure, but this seems cumbersome.
Is there
Hi
unsuitable. It seems that a Map Int (Map Int a) is the most suitable
structure, but this seems cumbersome.
You might want to use IntMap, which is a version of Map specialised to
Int's, with better time bounds.
Thanks
Neil
___
Haskell-Cafe
You might want to consider using a DiffArray, though if the
backtracking is of just the wrong sort, you might get worse
performance than you want. Updates are O(length xs) where xs is the
list of updates to be performed (so O(1) in the singleton case), but
lookups into older versions of the array