bintree_dump.c 674 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. * bintree_dump.c
  3. */
  4. #include <stdio.h>
  5. #include "private.h"
  6. /*--------------------------------------------------------- */
  7. void _lub_bintree_dump(lub_bintree_t * this, lub_bintree_node_t * node)
  8. {
  9. if (node->left) {
  10. _lub_bintree_dump(this, node->left);
  11. }
  12. printf(" %s%p",
  13. (this->root == node) ? "(R)" : "",
  14. lub_bintree_getclientnode(this, node));
  15. if (node->right) {
  16. _lub_bintree_dump(this, node->right);
  17. }
  18. }
  19. /*--------------------------------------------------------- */
  20. void lub_bintree_dump(lub_bintree_t * this)
  21. {
  22. if (this->root) {
  23. _lub_bintree_dump(this, this->root);
  24. }
  25. }
  26. /*--------------------------------------------------------- */