Skip to content

hapepo23/c-utilities

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C Utilities

C

Hash Table

A generic C implementation of a hash table using:

  • Associated data is stored alongside each key
  • Both key and data are handled generically via void *
  • Memory management hooks are provided for flexibility
  • Separate chaining for collision handling
  • User-provided hash and key comparison functions
  • Automatic resizing of the hash table
  • Iteration over all entries (unsorted) with user-provided function

Linked List

A generic C implementation of a sorted doubly linked list where:

  • Keys are sorted using a user-provided comparison function
  • Associated data is stored alongside each key
  • Both key and data are handled generically via void *
  • Memory management hooks are provided for flexibility
  • Iteration over all entries (ascending or descending) with user-provided function

Vector

A generic C implementation of a one-dimensional array data structure (Vector) where:

  • Each vector element has a key and value(s) of any type
  • Elements may be sorted according to the keys
  • Insert at the end or at specified index
  • Stable sort (merge sort) and binary search
  • Delete by index
  • Memory management hooks are provided for flexibility
  • Forward & reverse iteration, sorted or unsorted, with user-provided function

Ordered Set

A generic C implementation of an ordered set (a collection of unique elements where a total order is defined and maintained over the elements) with the following features:

  • AVL tree (named after inventors Adelson-Velsky and Landis): a self-balancing binary search tree.
  • Generic
  • Replace-on-insert
  • Deterministic iteration, all entries or only range from...to
  • Zero memory leaks

Security Notice

The code I released here into the public domain may appear in third-party projects. I do not maintain, endorse, or have any affiliation with such projects. Any malicious or deceptive use is unauthorized and should be reported to the hosting platform.


About

Some C Utilities: Generic Hash Table, Doubly Linked List, Vector/Array, Ordered Set

Topics

Resources

License

Stars

Watchers

Forks

Contributors