Monday 15 February 2010

image - min-heap with custom data type Python? -


I want to implement fast navigation method for encryption in Python. In literature, it has been implemented using a minimum stack. Since this involves adding, removing and reconstructing the data structure many times, and every time it is included in removing the smallest element. Therefore complexity for these tasks requires a minimum overload.

I know that a hap in-built module is in Python. It accepts a single float value, however, I need to store 3 different information materials related to pixels. Is there a way that I could possibly accept a list of I'll change the hap ?

Alternatively, is there a separate data structure with this functionality?

heap any type, Items are ordered if they are either & lt; should support less than or equal to either and operator ( hap later if it is not available to be available).

For example, you can use tuples ( (priority, your_data_structure) );

Or you can use those custom objects that apply at least one __lt __ , __Li__ , __ gt __ or __ gi __ to apply a comparison between them and thus a command (and, preferably, a __ eq __ equality method Also includes). After this, your class will be supplied with the remaining sections: from function Total_orudding @total_ordering class PixelInfo (object): def __init __ (auto, R, G, B): self . R, self (Self, c) == getattr (other, not included) C 'RGB' for C) DEF __lt __ (self, others): if not east (other, type (self)): Return NotImplemented return self.r + self.g + self.b & lt; Other R + other.g + other.b

will be an orderly custom class, which will be happy to handle for hacker .

No comments:

Post a Comment