代写C++代码 代做C++程序 C++辅导 C++教学

C++网络家教 远程写代码 在线Debug 讲解答疑 不是中介,本人直接写

微信: ittutor QQ: 14061936 Email: ittutor@qq.com

导航

Write a class called "Person" that contains several fields, including "lastName", "SSN", and "birthDate" fields; note that SSN should not be a numeric field, since we do not perform arithmetic with SSNs. The Person class should implement the IKeyed interface (see code below). Then write a class called "HashTable" providing the functionality of a hash table. Use the following stub to get started:

namespace HashingLab

{

    class HashTable : ICloneable 

    {

        private object[] items;

        private bool linearProbing;


        public HashTable(uint theSize, bool useLinearProbing = false)//optional parameter useLinearProbing defaults to false

        {

        }


        public void addItem< T >(T theItem)

        where T : IKeyed

        {

        }


        public bool retrieveItem< T >(ref T theItem)//theItem comes with its key fields filled, returns with all fields filled if found

        where T : IKeyed

        {

            return false;

        }


        public uint hashFunction(uint keyValue)

        {

            return 0;

        }


        public object Clone()

        {

            return null;

        }

    }


    interface IKeyed

    {

        uint getKey();

    }

}

Make sure that each of your class methods is functional! You may add private methods to HashTable, but do NOT change the public interface. Use the same algorithm for hashFunction that you submitted in Test Plan #3. Use the second constructor argument to determine the type of probing used: Implement quadratic probing if the value of "useLinearProbing" is false. 

Optional: 

(1) Implement deletion from the hash table. 

(2) Measure the amount of time it takes to add and retrieve items from the hash table under both linear and quadratic probing when the table is nearly full, and compare.


Make sure that your name appears in a comment at the top of each source file. Submit all source files, after first compressing them into a single file using the Windows file compression utility (NOT a commercial utility); the file extension should be .zip. 


相关推荐