short question:
Is there a way to implement a
efficient
decreaseKey
method for
SplMinHeap
(or any of the spl heaps) without
loosing the performance bonus?
Background:
For a private project I’m playing around with implementing a A* class and hoped to get a performance increase by using one of the spl heap structures. But I can’t get my head around on how to use these as they all lack decreaseKey or contains methods. Maybe I’m missing something completely?
Thanks a lot!
To implement the
decreaseKeymethod, we need to:Unless we need the entry with the smallest key, we don’t know where the entries are stored at all. Furthermore, even if we find the requested entry in an acceptable time, we just can’t update its key, regarding the methods of SplMinHeap.
So I don’t see an efficient way to implement the
decreaseKeymethod with the SplMinHeap data structure. Maybe you should implement YourHeap with YourCompleteBinaryTree realized by means of YourArrayList, for instance.