If you have to store keys and values, all you do is (in C# using my example) this:
Heap<(KeyType, ValueType)>
So there should only ever be one generic type, even if you need to store multiple values, you just pass in a type with multiple values.
Just wanted to clarify that. Let me know if that doesn't make sense and I will gladly elaborate.
But yeah. Hope the student had fun figuring out the algorithms of a heap. :)
Yeah, your template looks a lot like the templating stuff I'd use in C++ and Java (I don't know C# but I understand it is similar enough).
We both had fun working through the methods :D It is definitely good practice.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
If you have to store keys and values, all you do is (in C# using my example) this:
Heap<(KeyType, ValueType)>
So there should only ever be one generic type, even if you need to store multiple values, you just pass in a type with multiple values.
Just wanted to clarify that. Let me know if that doesn't make sense and I will gladly elaborate.
But yeah. Hope the student had fun figuring out the algorithms of a heap. :)
Yeah, your template looks a lot like the templating stuff I'd use in C++ and Java (I don't know C# but I understand it is similar enough).
We both had fun working through the methods :D It is definitely good practice.