Giter Club home page Giter Club logo

hashtable's Introduction

Hashtable

Hashtable介绍

  1. 构造
    1. 键值对
      1. 别名:key-value pairs(items)、ht_item
      2. 组成:char* key、char* value
    2. 哈希表
      1. 别名:hash_table、ht_hash_table
      2. 组成:int size、int count、ht_item** items
    3. 构造函数
      1. 特点:使用strdup()函数复制字符串
    4. 析构函数
      1. 特点:使用free()函数回收
  2. 哈希函数
    1. 功能:将字符串映射为0-size的一个数字
      1. 要求:尽量平均的分配到哈希表中
    2. collision
      1. 方法:二次散列
  3. API
    1. insert
      1. 功能:找到空闲桶放置item
      2. 特点:针对已被删除的项HT_DELETED_ITEM可以插入
    2. search
      1. 功能:找到key等于预期值的item
      2. 特点:针对已被删除的项HT_DELETED_ITEM需要跳过
    3. delete
      1. 特点:待删除item可能是某个冲突链的一项、删除会导致冲突项无法找到
      2. 方法:使删除项的位置指向一个全局哨兵(代表已删除)
    4. update
      1. 功能:再次插入相同key时会更新上一次的value
      2. 特点:集成到insert函数中(在寻找空闲位置的冲突链中比较是否存在key)
  4. resiezing
    1. 功能:当load<0.1时down、当load>0.7时up

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.