#675
Se dă un arbore binar care conține valori numere naturale. Să se afișeze frunzele acestui arbore.
Problema | BiFrunze | Operații I/O |
![]() bifrunze.in /bifrunze.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #57486530 | Utilizator | |
Fișier | bifrunze.cpp | Dimensiune | 1.37 KB |
Data încărcării | 02 Aprilie 2025, 08:14 | Scor / rezultat | Eroare de compilare |
bifrunze.cpp:8:17: error: field 'right' has incomplete type Node *left, right; ^ bifrunze.cpp:11:1: error: expected ';' after struct definition } ^ bifrunze.cpp: In constructor 'Node::Node(int)': bifrunze.cpp:10:44: error: class 'Node' does not have any field named 'right' Node(int val) : x(val), left(nullptr), right(nullptr) {} ^ bifrunze.cpp: In function 'void searchLeaf(Node*)': bifrunze.cpp:15:35: error: 'struct Node' has no member named 'right' if (!root -> left && !root -> right) ^ bifrunze.cpp:17:1: error: expected ';' before '}' token } ^ bifrunze.cpp:17:1: warning: statement has no effect [-Wunused-value] bifrunze.cpp: In function 'int main()': bifrunze.cpp:52:32: error: no matching function for call to 'Node::Node()' nodes[l] = new Node; ^ bifrunze.cpp:52:32: note: candidates are: bifrunze.cpp:10:5: note: Node::Node(int) Node(int val) : x(val), left(nullptr), right(nullptr) {} ^ bifrunze.cpp:10:5: note: candidate expects 1 argument, 0 provided bifrunze.cpp:5:8: note: constexpr Node::Node(const Node&) struct Node ^ bifrunze.cpp:5:8: note: candidate expects 1 argument, 0 provided bifrunze.cpp:5:8: note: constexpr Node::Node(Node&&) bifrunze.cpp:5:8: note: candidate expects 1 argument, 0 provided bifrunze.cpp:62:32: error: no matching function for call to 'Node::Node()' nodes[r] = new Node; ^ bifrunze.cpp:62:32: note: candidates are: bifrunze.cpp:10:5: note: Node::Node(int) Node(int val) : x(val), left(nullptr), right(nullptr) {} ^ bifrunze.cpp:10:5: note: candidate expects 1 argument, 0 provided bifrunze.cpp:5:8: note: constexpr Node::Node(const Node&) struct Node ^ bifrunze.cpp:5:8: note: candidate expects 1 argument, 0 provided bifrunze.cpp:5:8: note: constexpr Node::Node(Node&&) bifrunze.cpp:5:8: note: candidate expects 1 argument, 0 provided bifrunze.cpp:64:25: error: 'struct Node' has no member named 'right' nodes[i] -> right = nodes[r]; ^ bifrunze.cpp:72:22: error: 'class std::vector<int>' has no member named 'find' if (children.find(i) == children.end()) ^ bifrunze.cpp:27:11: warning: unused variable 'temp' [-Wunused-variable] Node *temp; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema BiFrunze 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ă.