Guest User

Untitled

a guest
Dec 16th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. struct AVL
  2. {
  3. int value;
  4. unsigned char height;
  5. AVL *left, *right;
  6. };
  7.  
  8. struct AVL
  9. {
  10. AVL *left, *right;
  11. int value;
  12. unsigned char height;
  13. };
  14.  
  15. #pragma pack(push, 1)
  16.  
  17. struct AVL
  18. {
  19. int value;
  20. unsigned char height;
  21. AVL *left, *right;
  22. };
  23.  
  24. #pragma pack(pop)
  25.  
  26. void bst_to_avl(BST *tree, AVL **root)
  27. {
  28. if (tree && root)
  29. {
  30. *root = avl_add(*root, tree->value);
  31. bst_to_avl(tree->left, root);
  32. bst_to_avl(tree->right, root);
  33. }
  34. }
  35.  
  36. #ifndef _BST_H_
  37. #define _BST_H_
  38. typedef struct BST BST;
  39.  
  40. struct BST
  41. {
  42. BST *left, *right;
  43. int value;
  44. };
  45.  
  46. BST *bst_add(BST *root, int num);
  47. void bst_free(BST *root);
  48. int count_peaks(BST *root);
  49. #endif
  50.  
  51. CC := gcc
  52. CFLAGS := -std=c99 -Wall -Werror
  53.  
  54. ifeq ($(mode), debug)
  55. CFLAGS += -g3
  56. endif
  57.  
  58. -include *.d
  59.  
  60. main.o: main.c *.h
  61. $(CC) -MMD $(CFLAGS) -c $<
  62.  
  63. %.o: %.c %.h
  64. $(CC) -MMD $(CFLAGS) -c $<
  65.  
  66. app.exe: main.o io.o BST.o AVL.o bst_to_avl.o arrgen.o hash_table.o search.o restruct.o
  67. $(CC) $^ -o $@
  68.  
  69. clean:
  70. rm *.o *.d *.exe
Add Comment
Please, Sign In to add comment