Yes, I did see that. How would I set the predicate to sort by
fScore? An integer in my struct.
On Monday, 2 April 2012 at 22:53:55 UTC, Justin Whear wrote:
On Tue, 03 Apr 2012 00:47:56 +0200, Chris Pons wrote:
I'm trying to work with and implement and priority queue(
min-heap ) and
a hash table. This is the first time I've worked with these
data
structures so I looked up some information about them to gain
an
understanding.
From what I read, a min-heap is a binary tree that is sorted
by a
priority. In my case I have a struct called Node for an A*
algorithm
that I wanted to place in a min-heap sorted by an integer,
their f
score. Initially the min-heap will only have one item in it
with others
added later.
How would I create a min-heap sorted by fScore? Will the list
stay
sorted after I add a new node?
As far as hash tables goes, it seems like I need to use an
associative
array, is that right?
What exactly would the key/hash be? How would I implement this
if the
hash table is supposed to contain the struct Node?
BinaryHeap in std.container can be made to work as a min-heap,
in fact
the documentation specifically mentions such a use:
http://dlang.org/
phobos/std_container.html#BinaryHeap