As to that, if it's already there, the method, somewhat based upon the java Map interface, returns a Value. Hence I had to return something.
Found the problem I think
I had
while(temp.next...
Type: Posts; User: javapenguin
As to that, if it's already there, the method, somewhat based upon the java Map interface, returns a Value. Hence I had to return something.
Found the problem I think
I had
while(temp.next...
Constant time? I thought it was more like logarithmic time. If you used hashing or an AVL tree, then you'd have about logarithmic time. It would probably get a bit closer to linear with hashing,...
Just wanted to write a Map class for the fun of it.
Also, it works with a linked list. You are right. My get method won't get the middle nodes. Perhaps I should store the keys in a set class....
What I'm baffled about is why my toString is only showing the first element, though my size method returns the right size and my getMethod() works fine.
I tried an implementation, but it only seems to be adding the first one, and not any others.
Why is that?
public class MyMap<K,V>
{
Actually, a sort of LinkedList would work. It wouldn't be an internal linked list, only it would involve next and previous links. However, it wouldn't be indexed, hence the possible need for the...
While I haven't started yet, per se, I have an idea, kind of, how it might work.
Right now, it would seem I might have to use two parallel LinkedLists, or DoublyLinkedLists, as I have made such a...