Ejemplo n.º 1
0
        // Take value in array(becoz its eassy) passed in DoubleValueKeyPair
        public void Add(K key, params V[] value)
        {
            List <DoubleValueKeyPair <K, V> > chain = FindChain(key, true);

            for (int i = 0; i < chain.Count; i++)
            {
                DoubleValueKeyPair <K, V> entry = chain[i];
                if (entry.Key.Equals(key))
                {
                    DoubleValueKeyPair <K, V> newEntry = new DoubleValueKeyPair <K, V>(key, value);
                    chain[i] = newEntry;
                    return;
                }

                chain = QuadracticProbing(key, true);
                if (chain == null)
                {
                    Console.WriteLine("Full");
                    return;
                }
                break;
            }
            chain.Add(new DoubleValueKeyPair <K, V>(key, value));
            this.size++;
        }
Ejemplo n.º 2
0
        public bool Remove(K key)
        {
            List <DoubleValueKeyPair <K, V> > chain = FindChain(key, false);

            for (int i = 0; i < chain.Count; i++)
            {
                DoubleValueKeyPair <K, V> entry = chain[i];
                if (entry.Key.Equals(key))
                {
                    chain.RemoveAt(i);
                }
            }
            return(false);
        }