1. Technology

List of Hash libraries for C Programmers

open Source Libraries to Help you code

By

This page is a collection of libraries that will help you in programming in C. Libraries here are open source and used to help you store data, without having to roll your own linked list etc data structures.

uthash

Developed by Troy D. Hanson, any C structure can be stored in a hash table using uthash. Just include #include "uthash.h" then add a UT_hash_handle to the structure and choose one or more fields in your structure to act as the key. Then use HASH_ADD_INT, HASH_FIND_INT and macros to store, retrieve or delete items from the hash table. It uses int, string and binary keys.

Judy
Judy is a C library that implements a sparse dynamic array. Judy arrays are declared simply with a null pointer and consumes memory only when populated. They can grow to use all available memory if desired. Judy's key benefits are scalability, high performance, and memory efficiency. It can be used for ynamically sized arrays, associative arrays or a simple-to-use interface that requires no rework for expansion or contraction and can replace many common data structures, such as arrays, sparse arrays, hash tables, B-trees, binary trees, linear lists, skiplists, other sort and search algorithms, and counting functions.

SGLIB SGLIB is short for for Simple Generic Library and consists of a single header file sglib.h that provides generic implementation of most common algorithms for arrays, lists, sorted lists and red-black trees. The library is generic and it does not define its own data structures. Rather it acts on existing user defined data structures via a generic interface. It also does not allocate or deallocate any memory and does not depend on any particular memory management.

All algorithms are implemented in form of macros parametrized by the type of data structure and comparator function (or comparator macro). Several further generic parameters such as the name of 'next' field for linked lists may be required for some algorithms and data structures.

For more c programming libraries and tools check out

  1. About.com
  2. Technology
  3. C / C++ / C#
  4. C Programming
  5. List of Hash libraries for C Programmers

©2014 About.com. All rights reserved.