#670
Se dă un arbore binar care conține valori numere naturale. Să se afișeze valorile din arbore în urma parcurgerii în preordine.
Notă: pentru reprezentarea arborelui se recomandă alocarea statică, folosind tablouri.
| Problema | Preordine | Operații I/O |
preordine.in/preordine.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64428045 | Utilizator | |
| Fișier | preordine.cpp | Dimensiune | 628 B |
| Data încărcării | 06 Mai 2026, 13:00 | Scor/rezultat | Eroare de compilare |
preordine.cpp:10:22: warning: missing terminating " character 10 | g<<nod[rad]<<"; | ^ preordine.cpp:10:22: error: missing terminating " character 10 | g<<nod[rad]<<"; | ^~ preordine.cpp: In function ‘void pre(int)’: preordine.cpp:10:12: error: ‘nod’ was not declared in this scope 10 | g<<nod[rad]<<"; | ^~~ preordine.cpp:11:13: error: ‘st’ was not declared in this scope; did you mean ‘std’? 11 | pre(st[rad]); | ^~ | std preordine.cpp:12:13: error: ‘dr’ was not declared in this scope 12 | pre(dr[rad]); | ^~ preordine.cpp: In function ‘int main()’: preordine.cpp:18:8: error: ‘n’ was not declared in this scope 18 | f>>n | ^ preordine.cpp:19:13: error: ‘i’ was not declared in this scope 19 | for(i=1;i<=n;i++) | ^ preordine.cpp:28:9: error: ‘fr’ was not declared in this scope; did you mean ‘f’? 28 | fr[st[i]]++; | ^~ | f preordine.cpp:28:12: error: ‘st’ was not declared in this scope; did you mean ‘ss’? 28 | fr[st[i]]++; | ^~ | ss preordine.cpp:29:12: error: ‘dr’ was not declared in this scope; did you mean ‘dd’? 29 | fr[dr[i]]++; | ^~ | dd preordine.cpp:33:12: error: ‘fr’ was not declared in this scope; did you mean ‘f’? 33 | if(fr[i]==0) | ^~ | f preordine.cpp:34:13: error: ‘rad’ was not declared in this scope; did you mean ‘rand’? 34 | rad=i; | ^~~ | rand preordine.cpp:35:13: error: ‘rad’ was not declared in this scope; did you mean ‘rand’? 35 | pre(rad) | ^~~ | rand preordine.cpp:17:9: warning: unused variable ‘x’ [-Wunused-variable] 17 | int x,ss,dd; | ^ preordine.cpp:17:11: warning: unused variable ‘ss’ [-Wunused-variable] 17 | int x,ss,dd; | ^~ preordine.cpp:17:14: warning: unused variable ‘dd’ [-Wunused-variable] 17 | int x,ss,dd; | ^~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Preordine 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ă.