Advertisement
Guest User

BinaryTree.h

a guest
Oct 28th, 2015
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1.  
  2. #ifndef BINARYTREE_H
  3. #define BINARYTREE_H
  4.  
  5. typedef int ( *SWO_t )( const void *, const void * );
  6.  
  7. struct BinaryTreeNode;
  8.  
  9. typedef struct {
  10. struct BinaryTreeNode *root;
  11. size_t count;
  12. SWO_t comes_before;
  13. } BinaryTree;
  14.  
  15. // Lifecycle operations...
  16. void BinaryTree_construct( BinaryTree *object, SWO_t strict_weak_ordering );
  17. void BinaryTree_destroy( BinaryTree *object );
  18.  
  19. // Non-modifying tree operations...
  20. size_t BinaryTree_size( const BinaryTree *object );
  21. const void *BinaryTree_min( const BinaryTree *object );
  22. const void *BinaryTree_max( const BinaryTree *object );
  23. const void *BinaryTree_lookup( const BinaryTree *object, const void *item );
  24.  
  25. // Modifying tree operations...
  26. void BinaryTree_insert( BinaryTree *object, const void *item );
  27. void BinaryTree_delete( BinaryTree *object, const void *item );
  28.  
  29. // Debugging operations...
  30. int BinaryTree_invariant( const BinaryTree *object );
  31.  
  32. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement