Implementation and performance comparison of open hashing and closed hashing

Source: Internet
Author: User

The general program realizes to add the data information, establishes the open hash list, the closed hash list, the hashing and the closed hashing search, the time performance analysis, as well as the overflow table establishment and the search these functions.

The following is a separate description of the principle:

Open a hash list: the use of single linked table storage mode, does not produce accumulation phenomenon, but because of the addition of pointer fields and increased space overhead.

Closed-list: The use of sequential table storage, storage efficiency is high, but easy to generate accumulation, find difficult to achieve, need to use two times to find.

Overflow table: The combination of open and closed hashing, the first sequence table holds similar pointer fields, and the second one stores overflow.




Realize:

#include <iostream> #include <cstdio> #include <stdio.h> #include <stdlib.h> #define HASHSIZE 53

#define MaxSize using namespace std;
    typedef struct {int key;
int si;

} HashTable1;
    void CreateHashTable1 (HashTable1 *h,int *a,int num)//hash table linear detection in hashes; {int i,d,cnt;
        for (i=0; i 



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.