#2746
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 | #63287907 | Utilizator | |
| Fișier | heap_sort.cpp | Dimensiune | 1.95 KB |
| Data încărcării | 25 Februarie 2026, 08:17 | Scor/rezultat | Eroare de compilare |
heap_sort.cpp:38:5: error: stray '\342' in program for (int i=2; i≤=n; i++) CombHeap(i-1, H[i]); ^ heap_sort.cpp:38:5: error: stray '\211' in program heap_sort.cpp:38:5: error: stray '\244' in program heap_sort.cpp:10:14: error: redefinition of 'std::ifstream fin' ifstream fin ("heap_sort.in") ; ^ heap_sort.cpp:4:10: error: 'std::ifstream fin' previously declared here ifstream fin ("heap_sort.in") ; ^ heap_sort.cpp:11:15: error: redefinition of 'std::ofstream fout' ofstream fout ("heap_sort.out"); ^ heap_sort.cpp:5:10: error: 'std::ofstream fout' previously declared here ofstream fout ("heap_sort.out"); ^ heap_sort.cpp:12:5: error: redefinition of 'int n' int n, val, i, H[1000001] ; ^ heap_sort.cpp:6:5: error: 'int n' previously declared here int n, val, i, H[1000001] ; ^ heap_sort.cpp:12:8: error: redefinition of 'int val' int n, val, i, H[1000001] ; ^ heap_sort.cpp:6:8: error: 'int val' previously declared here int n, val, i, H[1000001] ; ^ heap_sort.cpp:12:13: error: redefinition of 'int i' int n, val, i, H[1000001] ; ^ heap_sort.cpp:6:13: error: 'int i' previously declared here int n, val, i, H[1000001] ; ^ heap_sort.cpp:12:25: error: redefinition of 'int H [1000001]' int n, val, i, H[1000001] ; ^ heap_sort.cpp:6:16: error: 'int H [1000001]' previously declared here int n, val, i, H[1000001] ; ^ heap_sort.cpp: In function 'void CreareHeap()': heap_sort.cpp:38:24: warning: suggest parentheses around assignment used as truth value [-Wparentheses] for (int i=2; i≤=n; i++) CombHeap(i-1, H[i]); ^ heap_sort.cpp: In function 'void HeapSort()': heap_sort.cpp:43:5: error: 'TipCheie' was not declared in this scope TipCheie aux; ^ heap_sort.cpp:43:14: error: expected ';' before 'aux' TipCheie aux; ^ heap_sort.cpp:47:9: error: 'aux' was not declared in this scope aux=H[1]; ^ heap_sort.cpp: In function 'int main()': heap_sort.cpp:60:6: error: expected ';' before 'HeapSort' HeapSort() ^ heap_sort.cpp:61:24: warning: statement has no effect [-Wunused-value] for(int i = 1 ; i <=n ; i++) ^ heap_sort.cpp:61:33: error: expected ';' before ')' token for(int i = 1 ; i <=n ; i++) ^ heap_sort.cpp: In function 'void CombHeap(int, int)': heap_sort.cpp:66:6: error: redefinition of 'void CombHeap(int, int)' void CombHeap (int i, int n) ^ heap_sort.cpp:14:6: error: 'void CombHeap(int, int)' previously defined here void CombHeap (int i, int n) ^ heap_sort.cpp: In function 'void CreareHeap()': heap_sort.cpp:87:6: error: redefinition of 'void CreareHeap()' void CreareHeap() ^ heap_sort.cpp:35:6: error: 'void CreareHeap()' previously defined here void CreareHeap() ^ heap_sort.cpp: In function 'void HeapSort()': heap_sort.cpp:92:6: error: redefinition of 'void HeapSort()' void HeapSort() ^ heap_sort.cpp:41:6: error: 'void HeapSort()' previously defined here void HeapSort() ^ heap_sort.cpp: In function 'int main()': heap_sort.cpp:105:5: error: redefinition of 'int main()' int main() ^ heap_sort.cpp:54:5: error: 'int main()' previously defined here int main() ^
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ă.