which data structure to use?
Robert Voigtländer
r.voigtlaender at gmail.com
Tue Jan 21 06:17:43 EST 2014
Hi,
which would be the best data structure to use for the following case?
I have objects like this:
class Node(object):
def __init__(self, pos, parent, g , h):
self.pos = pos
self.parent = parent
self.g = g
self.h = h
self.f = g+h
I need to build a "list" of these objects. The amount is unknown.
On this list I need to regularly
1. check if a specific item - identified by Node.pos - is in the list.
2. find the object with the lowest Node.f attribute and update or remove it
What would be a good approach. Using a list I always need to traverse the whole list to do one of the above actions.
Thanks
Robert
More information about the Python-list
mailing list