which data structure to use?

Robert Voigtländer r.voigtlaender at gmail.com
Tue Jan 21 10:33:20 EST 2014


Am Dienstag, 21. Januar 2014 15:19:54 UTC+1 schrieb Peter Otten:
> Peter Otten wrote:
> 
> 
> 
> >     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



More information about the Python-list mailing list