Revision: 68424
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 18, 2015 06:47 by igotepava
Initial Code
struct node{ int label; node *left, *right; }; node *InitB(int x, node *T){ T = new node; T->left = T->right = NULL; T->label = x; return T; } node *RootB(node *T){ return T; } node *ParentB(int n, node *T){ if(T->label == n) return NULL; if(T->left){ if(T->left->label == n) return T; ParentB(n, T->left); } if(T->right){ if(T->right->label == n) return T; ParentB(n, T->right); } } node *LeftChildB(node *T){ return T->left; } node *RightChildB(node *T){ return T->right; } int LabelB(node *T){ return T->label; } void ChangeLabelB(int x, node *T){ T->label = x; } void CreateLeftB(int x, node *T){ if(T->left) cout << "Cvor vec ima dijete!\n"; else{ node *novi = new node; novi->label = x; novi->left = novi->right = NULL; T->left = novi; } } void CreateRightB(int x, node *T){ if(T->right) cout << "Cvor vec ima dijete!\n"; else{ node *novi = new node; novi->label = x; novi->left = novi->right = NULL; T->right = novi; } } void DeleteB(node *n, node *T){ if(n->left != NULL) DeleteB(n->left, T); if(n->right != NULL) DeleteB(n->right, T); delete n; }
Initial URL
Initial Description
Implementacija binarnog stabla pomoću pokazivaÄa.
Initial Title
binarno_stablo_pokazivac.h
Initial Tags
data
Initial Language
C++