Name

bistree_init

Synopsis

void bistree_init(BisTree *tree, void (*compare)(const void *key1, 
   const void *key2), void (*destroy)(void *data));

Return Value

None.

Description

Initializes the binary search tree specified by tree. This operation must be called for a binary search tree before the tree can be used with any other operation. The function pointer compare specifies a user-defined function to compare elements. This function should return 1 if key1 > key2, if key1 = key2, and -1 if key1 < key2. The destroy argument provides a way to free dynamically allocated data when bistree_destroy is called. It works in a manner similar to that described for bitree_destroy. For a binary search tree containing data that should not be freed, destroy should be set to NULL.

Complexity

O (1)

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.177.151