Header file C Language

Source: Internet
Author: User

/* Open_addressing_double_hash.h -- enable the address-specific hash header file */<br/> Enum kindofentry {legitimate, empty, deleted }; <br/> # define prime 7 </P> <p>/* data type definition */</P> <p> typedef int item; <br/> typedef struct cell <br/>{< br/> item; <br/> Enum kindofentry Info; <br/>} cell; <br/> typedef struct hashtable <br/>{< br/> int size; <br/> cell * lists; <br/>}* hashtable; </P> <p>/* interface function declaration */</P> <p>/* operation: generate a data based on the two transmitted data and return */<br/>/* before the operation: item and size are accepted data */<br/>/* after the operation: generates data based on item and size and returns */<br/> int Hash (const int item, const int size); </P> <p>/* operation: generate a data based on the two transmitted data and return */<br/>/* before the operation: item and prime are accepted data */<br/>/* after the operation: generates data based on item and prime and returns */<br/> int hash2 (const int item, const int prime); </P> <p>/* operation: before creating and initializing a table */<br/>/*: pH points to a table. Size indicates the table size variable */<br/>: if possible, create the table and leave all element data fields blank. If size is a prime number, set size to the table size. Otherwise, set the minimum prime number greater than size to the table size, 1 is returned; otherwise 0 */<br/> int initializetable (hashtable * const pH, const int size); </P> <p>/* operation: find and return a pointer to an element in the specified data field */<br/>/* before the operation: pH points to an initialized table, item indicates the data to be searched */<br/>/*: if possible, a pointer to the queried element is returned; otherwise, a pointer to the element position at the end of the search */<br/> cell * Find (const hashtable * const pH, const item) is returned ); </P> <p>/* operation: Add a data field to the table as the node of the specified data */<br/>/* before the operation, pH points to an initialized table, item indicates the added data */<br/>/*: if possible, if the data field is a new node of the specified data, it is added to the table and 1 is returned. Otherwise, no data is added, return 0 */<br/> int insert (const hashtable * const pH, const item); </P> <p>/* operation: delete a data field from the table as the specified data node */<br/>/* before the operation: pH points to an initialized table, item indicates the data to be deleted */<br/>/*: if possible, if a node of the specified data field is deleted from the table, 1 is returned; otherwise, no deletion is performed, return 0 */<br/> int Delete (const hashtable * const pH, const item); </P> <p>/* operation: from a low index to a high index, one function acts on all elements in the table one time */<br/>/* before the operation: pH points to an initialized table, and pfun points to a non-return value, after receiving a cell-type Parameter Function */<br/>: the function pointed to by pfun acts on all elements in the table one time from low index to High Index */<br/> void traversal (const hashtable * const pH, void (* pfun) (const cell); </P> <p>/* operation: Release the memory space occupied by a table */<br/>/* before the operation: after pH points to an initialized table */<br/>: the memory space occupied by the table is released */<br/> void release (const hashtable * const pH );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.