Example #1
0
        public void Remove(Key key)
        {
            LinkedList3 <Key, Value> list = hashtable[Hash(key)];

            if (list.Contains(key))
            {
                list.Remove(key);
                N--;
            }
        }
Example #2
0
 public HashST2(int M)
 {
     this.M    = M;
     N         = 0;
     hashtable = new LinkedList3 <Key, Value> [M];
     for (int i = 0; i < M; i++)
     {
         hashtable[i] = new LinkedList3 <Key, Value>();
     }
 }
Example #3
0
        public void Add(Key key, Value value)
        {
            LinkedList3 <Key, Value> list = hashtable[Hash(key)];

            if (list.Contains(key))
            {
                list.Set(key, value);
            }
            else
            {
                list.Add(key, value);
                N++;
            }
        }
Example #4
0
 public LinkedList3Dictionary()
 {
     list = new LinkedList3 <Key, Value>();
 }
Example #5
0
        public void Set(Key key, Value newValue)
        {
            LinkedList3 <Key, Value> list = hashtable[Hash(key)];

            list.Set(key, newValue);
        }
Example #6
0
        public Value Get(Key key)
        {
            LinkedList3 <Key, Value> list = hashtable[Hash(key)];

            return(list.Get(key));
        }
Example #7
0
        public bool Contains(Key key)
        {
            LinkedList3 <Key, Value> list = hashtable[Hash(key)];

            return(list.Contains(key));
        }