Advertisement
Crackbone

Sp-Vjezba9-wip

Dec 20th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.27 KB | None | 0 0
  1. /*Napisati program koji omogućava rad s binarnim stablom pretraživanja.
  2. Trebaomogućiti unošenje novog elementa u stablo,
  3. ispis elemenata, brisanje i pronalaženje nekog elementa.*/
  4.  
  5.  
  6.  
  7. #define _CRT_SECURE_NO_WARNINGS
  8.  
  9.  
  10.  
  11. #include<stdio.h>
  12. #include<errno.h>
  13.  
  14.  
  15. //Struktura
  16. struct node;
  17. typedef struct node* Pnode;
  18. struct node
  19. {
  20.     int broj;
  21.     Pnode L_Child;
  22.     Pnode R_Child;
  23. };
  24.  
  25.  
  26. //Funkcije
  27.  
  28. //ClearScren
  29. void clrscr()
  30. {
  31.     system("@cls||clear");
  32. }
  33.  
  34. //Meni:
  35. void meni();
  36.  
  37. //Unos novog elementa
  38. int Insert(Pnode P);
  39.  
  40. int main()
  41. {
  42.     Pnode R = NULL;
  43.  
  44.    
  45.  
  46.  
  47.     getchar();
  48.     getchar();
  49.     return;
  50. }
  51.  
  52. //Meni
  53. void meni()
  54. {
  55.  
  56.  
  57.     printf("\nUnos novog elementa u stablo:             1");
  58.     printf("\nIspis elemenata:                          2");
  59.     printf("\nPronadji element:                         3");
  60.     printf("\nObrisi element:                           4");
  61.     printf("\nExit:                                     5");
  62.  
  63.     return;
  64. }
  65.  
  66.  
  67. //Umetanje novoga elementa stabla
  68. int Insert(Pnode P)
  69. {
  70.     int x = 0;
  71.     Pnode q = NULL;
  72.     printf("\nKoji broj zelite unjeti? ");
  73.     scanf(" %d", &x);
  74.     q = (Pnode)malloc(sizeof(struct node));
  75.     if (NULL == q)
  76.     {
  77.             printf("\nGreska prilikom alokacije memorije. Error: %d", errno);
  78.             return -1;
  79.     }
  80.  
  81.     return 0;
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement