#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 | #64440944 | Utilizator | |
| Fișier | bst.cpp | Dimensiune | 1.63 KB |
| Data încărcării | 07 Mai 2026, 09:23 | Scor/rezultat | Eroare de compilare |
bst.cpp:1:1: error: ‘include’ does not name a type 1 | include <fstream> | ^~~~~~~ bst.cpp:4:1: error: ‘ifstream’ does not name a type 4 | ifstream fin ("bst.in"); | ^~~~~~~~ bst.cpp:5:1: error: ‘ofstream’ does not name a type 5 | ofstream fout ("bst.out"); | ^~~~~~~~ bst.cpp: In function ‘void Adaugare(int)’: bst.cpp:43:16: error: ‘NULL’ was not declared in this scope 43 | if (rad == NULL) | ^~~~ bst.cpp:1:1: note: ‘NULL’ is defined in header ‘<cstddef>’; did you forget to ‘#include <cstddef>’? +++ |+#include <cstddef> 1 | include <fstream> bst.cpp:52:17: error: ‘NULL’ was not declared in this scope 52 | while (p != NULL) | ^~~~ bst.cpp:52:17: note: ‘NULL’ is defined in header ‘<cstddef>’; did you forget to ‘#include <cstddef>’? bst.cpp:66:21: error: ‘NULL’ was not declared in this scope 66 | p->st = p->dr = NULL; | ^~~~ bst.cpp:66:21: note: ‘NULL’ is defined in header ‘<cstddef>’; did you forget to ‘#include <cstddef>’? bst.cpp: In function ‘void Inord(Nod*)’: bst.cpp:73:11: error: ‘NULL’ was not declared in this scope 73 | if(p!=NULL) | ^~~~ bst.cpp:73:11: note: ‘NULL’ is defined in header ‘<cstddef>’; did you forget to ‘#include <cstddef>’? bst.cpp:77:13: error: ‘fout’ was not declared in this scope 77 | fout<<p->cheie<<" "; | ^~~~ bst.cpp: In function ‘int main()’: bst.cpp:85:5: error: ‘fin’ was not declared in this scope 85 | fin >> n; | ^~~
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ă.