octarect / bheap

Binary heap library written in C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bheap

BuildStatus

Binary heap library written in C

bheap is binary heap implementation in C language.
As you know, binary heap is used in;

  • priority queue
  • heap sort

and so on. The data structure has better performance compared to others.

Usage

Code:

#include "bheap.h"
...
bheap *h = bheap_new();
bheap_push(h, 3, (void*)"three");
bheap_push(h, 1, (void*)"one");
bheap_push(h, 2, (void*)"two");
printf("%s\n", (char*)bheap_pop(h));
printf("%s\n", (char*)bheap_pop(h));
printf("%s\n", (char*)bheap_pop(h));
bheap_free(h);

Output:

one
two
three

See the directry tests/ to learn the library usage.

Contributing

Send a pull request to http://github.com/rk0der/bheap. We welcome your great
idea for this project. Feel free to contribute your code to the project. You can
use http://github.com/rk0der/bheap/issues for discussion.

License

MIT license (© 2018 Ryota Kota)

About

Binary heap library written in C

License:MIT License


Languages

Language:C 86.6%Language:Makefile 13.4%