FnZ Posted April 7, 2019 Share Posted April 7, 2019 #include <fstream> #include <map> #include <vector> using namespace std; ifstream cin("sort.in"); ofstream cout("sort.out"); vector < int > v; map < int, int > m; void indexSort() { for(int value : v) m[value]++; } int main() { int x; while(cin>>x) v.push_back(x); indexSort(); for(auto it = m.begin(); it != m.end(); it++) while(it->second--) cout<<it->first<<" "; cin.close(); cout.close(); return 0; } Este apropiat ca si complexitate de timp si eficienta ca sortul din alghoritm.h, intrebari in PM sau in acest topic, faceti-va de cap cu el . Sortul acesta poate fi implementat chiar si in PAWN pentru cei curiosi asa ca daca aveti sortari de facut puteti sa il luati cu incredere pe acesta. 1 Link to comment Share on other sites More sharing options...
Syconic Posted June 16, 2019 Share Posted June 16, 2019 Multumim, ce sa zic. Link to comment Share on other sites More sharing options...
Jackson Brooklyn Posted September 27, 2019 Share Posted September 27, 2019 Topic inactiv Link to comment Share on other sites More sharing options...
Recommended Posts