emilydolson/python-red-black-trees

Allow for the addition of Node objects

Opened this issue · 1 comments

A user may wish to extend the Node object, or implement the Node interface within a custom object. The RedBlackTree could be made to accept these objects and organize them appropriately. This would allow users to implement more complicated sorting strategies then just a singular int, like sorting against a tuple or a custom function.

One consideration is the delete function. Would the user have to provide the exact object they with to remove, or just a key? I guess both could work.

Alternatively, do you feel the better approach is to use the existing Node, and the user should add their custom object as the Node’s value?