⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chash.cpp

📁 data structures, algorithms and Application书的源代码
💻 CPP
字号:
// test chained hash table

#include <iostream.h>
#include "chash.h"

class element {
   friend void main(void);
   public:
      operator long() const {return key;}
      element& operator =(long y)
      {key = y; return *this;}
   private:
      int data;
      long key;
   };

ChainHashTable<element, long> h(11);
element e;

void main(void)
{
   e.key = 80;
   h.Insert(e);
   e.key = 40;
   h.Insert(e);
   e.key = 65;
   h.Insert(e);
   e.key = 58;
   h.Insert(e);
   e.key = 24;
   h.Insert(e);
   e.key = 2;
   h.Insert(e);
   e.key = 13;
   h.Insert(e);
   e.key = 46;
   h.Insert(e);
   e.key = 16;
   h.Insert(e);
   e.key = 7;
   h.Insert(e);
   e.key = 21;
   h.Insert(e);
   h.Delete(2,e);
   h.Delete(16,e);
   h.Delete(24,e);
   h.Delete(80,e);
   h.Output();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -