Results 1 to 10 of 10
Thread: C++
Hybrid View
-
3rd May 2018 12:10 #1Registered User
Join Date: Mar:2018
Location: pleven
Posts: 6
C++
.
-
3rd May 2018 12:12 #2Banned
Join Date: Mar:2008
Location: ( ͡ ͜ʖ ͡)
Posts: 10,614
?
-
3rd May 2018 12:23 #3Registered User
Join Date: Mar:2018
Location: pleven
Posts: 6
struct elemlist
{
int key;
elemlist *next;
} *start = NULL;
//Strukturata za durvo
struct elemtree
{
int key;
elemtree *left;
elemtree *right;
int bal;
} *root = NULL;
//Izvejdane na spisuka
void list()
{
if(start)
{
cout<<"\nList: ";
elemlist *p = start;
while(p)
{
cout<<p -> key<<" ";
p = p -> next;
}
}
else cout<<"\nEmpty List";
cout<<"\n\n";
system("pause");
system("cls");
}
//Dobavqne na element v spisuka otnachalo
void add_b(int n)
{
elemlist *p = start;
start = new elemlist;
start -> key = n;
start -> next = p;
}
//Dobavqne na element v spisuka otkraq
void add_e(int n)
{
elemlist *p = start, *q;
q = new elemlist;
q -> key = n;
q -> next = NULL;
if(start == NULL) start = q;
else
{
while(p -> next) p = p -> next;
p -> next = q;
}
}
//Za slagane na tabulatori pri izvejdane na durvoto
void printnode(int n, int h)
{
for(int i = 0; i < h; i++) cout<<"\t";
cout<<n<<endl;
}
//Za izvejdane na durvoto
void show(elemtree *t, int h)
{
if(t)
{
//cout<<t -> key;
show(t -> right,h+1);
printnode(t -> key,h);
show(t -> left,h+1);
}
}
//Za dobavqne na element v durvoto
void add(int n, elemtree *&t)
{
if(t == NULL)
{
t = new elemtree;
t -> key = n;
t -> bal = 0;
t -> left = t -> right = NULL;
}
else
{
if(t -> key > n)
{
if(t -> bal != -1) t -> bal--;
add(n,t -> left);
}
else
{
if(t -> key < n)
{
if(t -> bal != 1) t -> bal++;
add(n,t -> right);
}
}
}
}
-
4th May 2018 01:25 #4a.k.a. alexandar888
Join Date: Dec:2008
Location:
Posts: 1,071
, .
-
4th May 2018 03:26 #5Registered User
Join Date: Apr:2007
Location:
Posts: 184
pepi9846, .

. . , . , , - , .
, , . , , - . . , - .
AVL Trees: Tutorial and C++ Implementation - AVL Brad Appleton. , .Last edited by BBelchev; 4th May 2018 at 03:32.
-
4th May 2018 15:00 #6Registered User
Join Date: Mar:2018
Location: pleven
Posts: 6
. .
-
5th May 2018 01:01 #7Mire-x
Join Date: Apr:2005
Location: Sofia
Posts: 763
.
(10b) || !(10b)




Reply With Quote
Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in