#include<iostream>
using namespace std;
struct node {
int val;
node *L;
node *R;
node *O;
node() { node *O = NULL; };
};
void insertbst(node *&root, int x) {
if (root == NULL) {
root = new node;
root->val = x;
root->L = root->R = NULL;
cout << "nic tu nie ma" << endl;
}
else {
if (x < root->val) {
insertbst(root->L, x);
root->L->O = root;
cout << "idziemy głębiej w lewo..." << endl;
}
else {
insertbst(root->P, x);
root->P->O = root;
cout << "idziemy głębiej w prawo..." << endl;
}
}
}
void inorder(node *&root) {
if (root != NULL) {
inorder(root->L);
cout << root->val << " ";
inorder(root->P);
}
}
int main() {
node *root = NULL;
insertbst(root, 4);
insertbst(root, 2);
insertbst(root, 11);
insertbst(root, 1);
insertbst(root, 7);
insertbst(root, 25);
inorder(root);
system("PAUSE");
return 0;
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}