#3010
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 | #64797282 | Utilizator | |
| Fișier | bst.cpp | Dimensiune | 742 B |
| Data încărcării | 02 Iunie 2026, 08:29 | Scor/rezultat | Eroare de compilare |
bst.cpp:4:1: error: expected ‘,’ or ‘;’ before ‘FILE’ 4 | FILE *g=fopen("bst.out","w") | ^~~~ bst.cpp:6:9: error: ‘nod’ does not name a type 6 | typedef nod*ref; | ^~~ bst.cpp:7:6: error: variable or field ‘inserare’ declared void 7 | void inserare(ref &r,int x) | ^~~~~~~~ bst.cpp:7:15: error: ‘ref’ was not declared in this scope 7 | void inserare(ref &r,int x) | ^~~ bst.cpp:7:20: error: ‘r’ was not declared in this scope 7 | void inserare(ref &r,int x) | ^ bst.cpp:7:22: error: expected primary-expression before ‘int’ 7 | void inserare(ref &r,int x) | ^~~ bst.cpp:21:6: error: variable or field ‘srd’ declared void 21 | void srd(ref r) | ^~~ bst.cpp:21:10: error: ‘ref’ was not declared in this scope 21 | void srd(ref r) | ^~~ bst.cpp: In function ‘int main()’: bst.cpp:33:5: error: expected initializer before ‘fscanf’ 33 | fscanf(f,"%d",&n); | ^~~~~~ bst.cpp:36:24: error: ‘x’ was not declared in this scope 36 | fscanf(f,"%d",&x); | ^ bst.cpp:37:18: error: ‘r’ was not declared in this scope 37 | inserare(r,x); | ^ bst.cpp:37:9: error: ‘inserare’ was not declared in this scope 37 | inserare(r,x); | ^~~~~~~~ bst.cpp:39:9: error: ‘r’ was not declared in this scope 39 | srd(r); | ^ bst.cpp:39:5: error: ‘srd’ was not declared in this scope; did you mean ‘std’? 39 | srd(r); | ^~~ | std bst.cpp:41:12: error: ‘g’ was not declared in this scope 41 | fclose(g); | ^ bst.cpp:32:11: warning: unused variable ‘i’ [-Wunused-variable] 32 | int n,i,xl | ^
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ă.