Пример #1
0
        public void print()
        {
            HashNode current = null;

            for (int i = 0; i < size; i++)
            {
                current = table[i];
                while (current != null)
                {
                    Console.Write(current.getdata() + " ");
                    current = current.getNextNode();
                }
                Console.WriteLine();
            }
        }
Пример #2
0
        public Persona retrieve(int key)
        {
            int hash = key % size;

            while (table[hash] != null && table[hash].getkey() % size != key % size)
            {
                hash = (hash + 1) % size;
            }
            HashNode current = table[hash];

            while (current.getkey() != key && current.getNextNode() != null)
            {
                current = current.getNextNode();
            }
            if (current.getkey() == key)
            {
                return(current.getdata());
            }
            else
            {
                return(null);
            }
        }