散列函数构造散列表_散列(散列表,散列函数及其特征)

散列函数构造散列表

散列 (Hashing)

There are many possibilities for representing the dictionary and one of the best methods for representing is hashing. Hashing is a type of a solution which can be used in almost all situations. Hashing is a technique which uses less key comparisons and searches the element in O(n) time in the worst case and in an average case it will be done in O(1) time. This method generally used the hash functions to map the keys into a table, which is called a hash table.

表示字典有很多可能,而表示哈希的最佳方法之一就是哈希 。 哈希是一种解决方案,几乎可以在所有情况下使用。 散列是一种使用键比较少并在最坏情况下以O(n)时间搜索元素的技术,而在一般情况下,散列将在O(1)时间进行。 此方法通常使用哈希函数将键映射到表中,该表称为哈希表

1) Hash table

1)哈希表

Hash table is a type of data structure which is used for storing and accessing data very quickly. Insertion of data in a table is based on a key value. Hence every entry in the hash table is defined with some key. By using this key data can be searched in the hash table by few key comparisons and then searching time is dependent upon the size of the hash table.

哈希表是一种数据结构,用于非常快速地存储和访问数据。 表中数据的插入基于键值。 因此,哈希表中的每个条目都用某个键定义。 通过使用此键,可以通过几次键比较在哈希表中搜索数据,然后搜索时间取决于哈希表的大小。

2) Hash function

2)哈希函数

Hash function is a function which is applied on a key by which it produces an integer, which can be used as an address of hash table. Hence one can use the same hash function for accessing the data from the hash table. In this the integer returned by the hash function is called hash key.

散列函数是一种应用于键的函数,通过它可以产生整数,该整数可用作散列表的地址。 因此,可以使用相同的哈希函数来访问哈希表中的数据。 在这种情况下,哈希函数返回的整数称为哈希密钥。

哈希函数的类型 (Types of hash function)

There are various types of hash function which are used to place the data in a hash table,

有多种类型的哈希函数,用于将数据放入哈希表,

1. Division method

1.分割方法

In this the hash function is dependent upon the remainder of a division. For example:-if the record 52,68,99,84

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值