How to use libavl?

I am trying to use GNU libavl( http://adtinfo.org/ ) for one of my academic projects. I need a fairly simple guide to using the BST (binary search) implementation provided by the library. I need to make a pair (key, value) (about 30,000 lines and there frequencies) using BST according to the value. Although the library is well documented, it does not give a direct answer to my question, and I do not have time to read all the documentation and test code. I would like to know if there is a faster way to sort.

+4
source share
2 answers
int main(int argc, char **argv)
{
    tree *avl_tree = NULL;
    struct data tmp;
    unsigned result;

    (void) argc;
    (void) argv;

    // Initialize a new tree with our three previously defined
    // functions to store data structure.
    avl_tree = init_dictionnary(data_cmp, data_print, data_delete, data_copy);

    tmp.key = 42;
    tmp.value = 4242;

    // Add element {42, 4242} in our tree.
    result = insert_elmt(avl_tree, &tmp, sizeof(struct data));
+2

, GNU libavl. .

- . ,

, .

, , - , GNU libavl. , .

GNU libavl , . TexiWEB, C, .

:

$ git clone git://git.savannah.gnu.org/avl.git

avl :

$ make programs

C .

, . -test.c. , AVL avl-test.c.

, GNU libavl , C .

0

Source: https://habr.com/ru/post/1529749/


All Articles