#2746
Heap Sort
Se dă n
și un sir cu n
elemente, numere naturale. Folosind metoda HeapSort
, să se sorteze crescător șirul și să se afișeze elementele sale, separate prin câte un spațiu.
Problema | Heap Sort | Operații I/O |
![]() heap_sort.in /heap_sort.out
|
---|---|---|---|
Limita timp | 0.45 secunde | Limita memorie |
Total: 64 MB
/
Stivă 64 MB
|
Id soluție | #58471118 | Utilizator | |
Fișier | heap_sort.cpp | Dimensiune | 2.15 KB |
Data încărcării | 08 Iunie 2025, 16:47 | Scor / rezultat | Eroare de compilare |
heap_sort.cpp: In function 'void insert(heap*, int)': heap_sort.cpp:37:9: error: 'runtime_error' is not a member of 'std' throw std::runtime_error("Overflow"); ^ heap_sort.cpp: In function 'int top(heap*)': heap_sort.cpp:51:8: error: 'runtime_error' is not a member of 'std' throw std::runtime_error("Heap is empty"); ^ heap_sort.cpp: In function 'int pop(heap*)': heap_sort.cpp:71:9: error: 'runtime_error' is not a member of 'std' throw std::runtime_error("Heap is empty"); ^ heap_sort.cpp: In function 'void vectToHeap(heap*, const std::vector<int>&)': heap_sort.cpp:80:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0;i < vec.size();i++) ^ heap_sort.cpp: In function 'int top(heap*)': heap_sort.cpp:53:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Heap Sort 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ă.