Revision: 68516
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 19, 2015 07:36 by akljaic
Initial Code
#include <iostream>
using namespace std;
void AddElement(int x, int root, btree *T){
bool ponovi = true;
do{
if(x < LabelB(root,T)){
if(ExistLeftChild(root,T))
root = LeftChildB(root,T);
else{
CreateLeftB(x,root,T);
ponovi = false;
}
}
else if(x > LabelB(root,T)){
if(ExistRightChild(root,T))
root = RightChildB(root,T);
else{
CreateRightB(x,root,T);
ponovi = false;
}
}
}while(ponovi);
}
bool Find(int x, int root, btree *T){
bool ponovi = true;
bool nadjen = false;
do{
if(x == LabelB(root,T)){
nadjen = true;
ponovi = false;
}
if(x < LabelB(root,T)){
if(ExistLeftChild(root,T))
root = LeftChildB(root,T);
else
ponovi = false;
}
else if (x > LabelB(root,T)){
if(ExistRightChild(root,T))
root = RightChildB(root,T);
else
ponovi = false;
}
}while(ponovi);
return nadjen;
}
Initial URL
asdf
Initial Description
asdf
Initial Title
pretrazivanje.h
Initial Tags
Initial Language
C++