Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Napisati program koji omogućava rad s binarnim stablom pretraživanja.
- Trebaomogućiti unošenje novog elementa u stablo,
- ispis elemenata, brisanje i pronalaženje nekog elementa.*/
- #define _CRT_SECURE_NO_WARNINGS
- #include<stdio.h>
- #include<errno.h>
- //Struktura
- struct node;
- typedef struct node* Pnode;
- struct node
- {
- int broj;
- Pnode L_Child;
- Pnode R_Child;
- };
- //Funkcije
- //ClearScren
- void clrscr()
- {
- system("@cls||clear");
- }
- //Meni:
- void meni();
- //Unos novog elementa
- int Insert(Pnode P);
- int main()
- {
- Pnode R = NULL;
- getchar();
- getchar();
- return;
- }
- //Meni
- void meni()
- {
- printf("\nUnos novog elementa u stablo: 1");
- printf("\nIspis elemenata: 2");
- printf("\nPronadji element: 3");
- printf("\nObrisi element: 4");
- printf("\nExit: 5");
- return;
- }
- //Umetanje novoga elementa stabla
- int Insert(Pnode P)
- {
- int x = 0;
- Pnode q = NULL;
- printf("\nKoji broj zelite unjeti? ");
- scanf(" %d", &x);
- q = (Pnode)malloc(sizeof(struct node));
- if (NULL == q)
- {
- printf("\nGreska prilikom alokacije memorije. Error: %d", errno);
- return -1;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement