简体   繁体   English

哈希表最大功能

[英]Hash table max function

I am currently working on hash tables and the double probe. 我目前正在研究哈希表和双探针。 I was given the following function to use but cant find the library that it is in. 我被赋予了以下功能,但无法找到它所在的库。

max(1,(K/size) % size)

Is this function in a library or does it mean something that I have not discovered yet? 这个函数是在库中还是它意味着我还没有发现的东西?

They are not defined in C library. 它们未在C库中定义。 You can create your own C library and define them or can create MACRO 您可以创建自己的C库并定义它们,也可以创建MACRO

MACRO can be defined as MACRO可以定义为

      #define MAX(x, y) (((x) > (y)) ? (x) : (y))
      #define MIN(x, y) (((x) < (y)) ? (x) : (y))

Use it as follows 使用方法如下

      int max = MAX(1,(K/size) % size);

All the calls to an MACRO get replaced with the macro expansion during the pre-processing. 在预处理期间,所有对MACRO的调用都被宏扩展替换。 So above call get replaced as, 因此,以上呼叫被替换为,

      int max = (((1) > ((K/size)%size)) ? (1) : ((K/size)%size));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM