dimanche 22 avril 2018

Desing conflict when programming with inheritance

So I am programming tree types of generic(key, value) bynary search trees, the basic one, which is unbalanced, it has add, search and delete operations. It has a Node(another k,v generic clases, used to store this data) attribute which is the root of the tree.The Next type of tree is a Red-Black Tree, so the big questions is how to use Java inheritance to code this new class using the first one as a basis. Its confusing to me because,althought both classes have a root attribute, one has a Node atribute and the other should have a Red-Black Node (which should extends from Node, adding a color attribute). I am kind of assuming that people know how a binary seach Tree works.Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire