当前位置:   article > 正文

C++实现哈希表的创建,销毁,键值插入与删除_c++ 哈希表删除键

c++ 哈希表删除键

  1. /*
  2. * HashTable.h
  3. *
  4. * Created on: Nov 19, 2015
  5. * Author: chris
  6. */
  7. #pragma once
  8. #include <iostream>
  9. const int numofsizes = 7;
  10. const int hashsize[] = { 11, 19, 31, 41, 53, 61, 71 };
  11. typedef int KeyType;
  12. typedef int ElemType;
  13. struct HashCell{
  14. bool null_key;
  15. KeyType key;
  16. HashCell() : null_key(true), key(0) {}
  17. };
  18. struct HashTable{
  19. HashCell * cells;
  20. int count;
  21. int sizeindex;
  22. };
  23. bool HashTableInit(HashTable & H);
  24. void HashTableDestroy(HashTable & H);
  25. int HashTableHashKeyDirectAddr(HashTable & H, KeyType K);
  26. bool HashTableSearchKey(HashTable & H, KeyType K, int& p, int& c);
  27. bool HashTableInsertKey(HashTable & H, KeyType K);
  28. bool HashTableDeleteKey(HashTable & H, KeyType K);
  29. void HashTableDisplay(HashTable & H);



  1. /*
  2. * HashTable.cpp
  3. *
  4. * Created on: Nov 19, 2015
  5. * Author: chris
  6. */
  7. #
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/325154
推荐阅读
相关标签
  

闽ICP备14008679号