#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 | #64775834 | Utilizator | |
| Fișier | bst.cpp | Dimensiune | 736 B |
| Data încărcării | 29 Mai 2026, 15:11 | Scor/rezultat | Eroare de compilare |
bst.cpp:1:9: error: #include expects "FILENAME" or <FILENAME> 1 | #include | ^ bst.cpp: In function ‘void Inserare(nod*&, long long int)’: bst.cpp:11:10: error: ‘NULL’ was not declared in this scope 11 | if (R == NULL) { | ^~~~ bst.cpp:1:1: note: ‘NULL’ is defined in header ‘<cstddef>’; did you forget to ‘#include <cstddef>’? +++ |+#include <cstddef> 1 | #include bst.cpp: At global scope: bst.cpp:27:22: error: ‘ofstream’ has not been declared 27 | void Afisare(nod *R, ofstream &g) { | ^~~~~~~~ bst.cpp: In function ‘void Afisare(nod*, int&)’: bst.cpp:28:10: error: ‘NULL’ was not declared in this scope 28 | if (R != NULL) { | ^~~~ bst.cpp:28:10: note: ‘NULL’ is defined in header ‘<cstddef>’; did you forget to ‘#include <cstddef>’? bst.cpp:30:14: error: invalid operands of types ‘int’ and ‘const char [2]’ to binary ‘operator<<’ 30 | g << R->info << " "; | ~~~~~~~~~~~~ ^~ ~~~ | | | | int const char [2] bst.cpp: In function ‘int main()’: bst.cpp:36:1: error: ‘ifstream’ was not declared in this scope 36 | ifstream f("bst.in"); | ^~~~~~~~ bst.cpp:1:1: note: ‘std::ifstream’ is defined in header ‘<fstream>’; did you forget to ‘#include <fstream>’? +++ |+#include <fstream> 1 | #include bst.cpp:37:1: error: ‘ofstream’ was not declared in this scope 37 | ofstream g("bst.out"); | ^~~~~~~~ bst.cpp:37:1: note: ‘std::ofstream’ is defined in header ‘<fstream>’; did you forget to ‘#include <fstream>’? bst.cpp:40:1: error: ‘f’ was not declared in this scope 40 | f >> n; | ^ bst.cpp:42:10: error: ‘NULL’ was not declared in this scope 42 | nod *R = NULL; | ^~~~ bst.cpp:42:10: note: ‘NULL’ is defined in header ‘<cstddef>’; did you forget to ‘#include <cstddef>’? bst.cpp:50:12: error: ‘g’ was not declared in this scope 50 | Afisare(R, g); | ^
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ă.