#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.35 secunde | Limita memorie |
Total: 4 MB
/
Stivă 1 MB
|
Id soluție | #50518294 | Utilizator | |
Fișier | heap_sort.cpp | Dimensiune | 358 B |
Data încărcării | 12 Aprilie 2024, 15:13 | Scor / rezultat | Eroare de compilare |
heap_sort.cpp:6:39: error: wrong number of template arguments (0, should be 1) priority_queue<int,vector<int>,greater<>>q; ^ In file included from /usr/include/c++/4.8/string:48:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from heap_sort.cpp:1: /usr/include/c++/4.8/bits/stl_function.h:222:12: error: provided for 'template<class _Tp> struct std::greater' struct greater : public binary_function<_Tp, _Tp, bool> ^ heap_sort.cpp:6:40: error: template argument 3 is invalid priority_queue<int,vector<int>,greater<>>q; ^ heap_sort.cpp:6:43: error: invalid type in declaration before ';' token priority_queue<int,vector<int>,greater<>>q; ^ heap_sort.cpp: In function 'int main()': heap_sort.cpp:12:11: error: request for member 'push' in 'q', which is of non-class type 'int' q.push(a); ^ heap_sort.cpp:14:14: error: request for member 'empty' in 'q', which is of non-class type 'int' while(!q.empty()){ ^ heap_sort.cpp:15:17: error: request for member 'top' in 'q', which is of non-class type 'int' cout<<q.top()<<" "; ^ heap_sort.cpp:16:11: error: request for member 'pop' in 'q', which is of non-class type 'int' q.pop(); ^
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ă.