which data structure to use?
Robert Voigtländer
r.voigtlaender at gmail.com
Tue Jan 21 10:37:47 EST 2014
> > > def pop(self):
> > > f, node = heapq.heappop()
> > > del lookup[node.pos]
> > > return node
> > That should be
>
> > def pop(self):
>
> > f, node = heapq.heappop(self.heap)
> > del self.lookup[node.pos]
> > return node
>
> Hi Peter,
> this works great. I will try to find some info about the functionality you used and to understnad what you did.
> Maybe you can add a function to remove a node?
> Thanks for your support and all tthe swift answers.
>
> Robert
Just realized what the pop function is for. I changed it from:
def pop(self):
to
def pop(self,pos):
and it works.
Now I go on with trying to understand it.
More information about the Python-list
mailing list