Exemplo n.º 1
0
 public HashTab(int num)
 {
     length = num;
     Tab    = new HashTabItem[num];
     for (int i = 0; i < Length; i++)
     {
         Tab[i] = new HashTabItem();
     }
 }
Exemplo n.º 2
0
 public HashTab()
 {
     length = 20;
     Tab    = new HashTabItem[20];
     for (int i = 0; i < Length; i++)
     {
         Tab[i] = new HashTabItem();
     }
 }
Exemplo n.º 3
0
        //add
        public void Add(string firstname, string numAuto, string modelAuto)
        {
            HashTabItem tmp   = new HashTabItem(1, firstname, numAuto, modelAuto);
            uint        index = djb_hash(firstname);
            bool        flag  = false;

            while (Tab[index].Status == 1 && !flag)
            {
                index++;
                if (index == Length)
                {
                    index = 0;
                }
                if (index == djb_hash(firstname))
                {
                    flag = true;
                }
            }
            if (!flag)
            {
                Tab[index] = tmp;
            }
        }