Giter Site home page Giter Site logo

coucal's Introduction

coucal

Coucal, a Cuckoo-hashing-based hashtable with stash area C library.

Greater Coucal Centropus sinensis

[Wikipedia] A coucal is one of about 30 species of birds in the cuckoo family. All of them belong in the subfamily Centropodinae and the genus Centropus. Unlike many Old World cuckoos, coucals are not brood parasites.

This is an implementation of the cuckoo hashing algorithm (Rasmus Pagh and Flemming Friche Rodler, http://www.it-c.dk/people/pagh/papers/cuckoo-jour.pdf) with a stash area (Adam Kirsch, Michael Mitzenmacher and Udi Wieder, http://research.microsoft.com/pubs/73856/stash-full.9-30.pdf), using by default the MurmurHash hash function (Austin Appleby, http://en.wikipedia.org/wiki/MurmurHash).

This allows an efficient generic hashtable implementation, with the following features:

  • guaranteed constant time (Θ(1)) lookup
  • guaranteed constant time (Θ(1)) delete or replace
  • average constant time (O(1)) insert
  • one large memory chunk for table (and one for the key pool)
  • simple enumeration

This library has been thoroughly tested, and is currently used by the HTTrack project in production.

License

Copyright © 2013-2014 Xavier Roche (http://www.httrack.com/). All rights reserved.

This library is licensed under the BSD 3-Clause License See the LICENSE file.

Example

coucal hashtable = coucal_new(0);
coucal_write_pvoid(hashtable, "foo", "bar");

printf("value==%s\n", (char*) coucal_get_pvoid(hashtable, "foo"));

struct_coucal_enum enumerator = coucal_enum_new(hashtable);
coucal_item *item;
while((item = coucal_enum_next(&enumerator)) != NULL) {
  printf("%s=%s\n", (const char*) item->name, (const char*) item->value.ptr);
}

coucal's People

Contributors

xroche avatar

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.