Categories
Libraries
  • Github CLI
  • SSH
  • HTTPS
Clone Repo

Zig rewrite of trees from OpenBSD.

Data structures ported

  • splay tree
  • red-black tree (you may want to use AVL tree instead)

Usage

See src/main.zig for usage.

To use this library in your project, copy the file into your project and rename it as tree.zig or something.

Note about splay tree

There is potential footgun when freeing nodes of a tree. See test "how to free nodes correctly" in src/main.zig for correct usage.

Enhancements over the original:

  • proper generic type
  • tree.prev(node)

Also, the original C impl has some weird design choices, which I will not touch.

Also, invalid data given to the public API will not crash the program.

About
tree.h from OpenBSD, ported to Zig
Owner
iacore (User)
Last Commit
2023-10-06
Latest Release
Latest Release Date
Created
2023-10-06