#3010
bst
Un arbore binar de căutare (BST – Binary Search Tree) este un arbore binar cu proprietatea că valoarea memorată într-un nod este mai mare decât valoarea memorată în orice nod din subarborele său stâng și este mai mică sau egală decât valoarea memorată în orice nod din subarborele său drept. Dându-se un șir de n
numere naturale, să se ordoneze crescător utilizând un BST.
Folclorul informatic
Problema | bst | Operații I/O |
bst.in /bst.out
|
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #22065390 | Utilizator | |
Fișier | bst.cpp | Dimensiune | 662 B |
Data încărcării | 24 Martie 2020, 11:38 | Scor / rezultat | Eroare de compilare |
bst.cpp:3:22: error: expected ';' at end of member declaration struct nod{int s,d,v,n}*v; ^ bst.cpp:4:1: error: 'ifstream' does not name a type ifstream in("bst.in"); ^ bst.cpp:5:1: error: 'ofstream' does not name a type ofstream out("bst.out"); ^ bst.cpp: In function 'void ins(nod*&, int)': bst.cpp:9:12: warning: converting to non-pointer type 'int' from NULL [-Wconversion-null] v->s=NULL; ^ bst.cpp:10:13: warning: converting to non-pointer type 'int' from NULL [-Wconversion-null] v->d=NULL; ^ bst.cpp:16:22: error: invalid initialization of reference of type 'nod*&' from expression of type 'int' ins(v->d,val); ^ bst.cpp:6:6: error: in passing argument 1 of 'void ins(nod*&, int)' void ins(nod* &v,int val){ ^ bst.cpp:19:23: error: invalid initialization of reference of type 'nod*&' from expression of type 'int' ins(v->s,val); ^ bst.cpp:6:6: error: in passing argument 1 of 'void ins(nod*&, int)' void ins(nod* &v,int val){ ^ bst.cpp: In function 'void ino(nod*)': bst.cpp:25:13: error: invalid conversion from 'int' to 'nod*' [-fpermissive] ino(v->s); ^ bst.cpp:23:6: error: initializing argument 1 of 'void ino(nod*)' [-fpermissive] void ino(nod* v){ ^ bst.cpp:27:9: error: 'out' was not declared in this scope out<<v->v<<" "; ^ bst.cpp:28:13: error: invalid conversion from 'int' to 'nod*' [-fpermissive] ino(v->d); ^ bst.cpp:23:6: error: initializing argument 1 of 'void ino(nod*)' [-fpermissive] void ino(nod* v){ ^ bst.cpp: In function 'int main()': bst.cpp:31:5: error: 'in' was not declared in this scope in>>n;int x; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema bst face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.