Skip to content

Latest commit

 

History

History
86 lines (71 loc) · 5.69 KB

README.md

File metadata and controls

86 lines (71 loc) · 5.69 KB

C++ program to demonstrate radix sort

License: WTFPL Open Source Love svg1 C++

How can you run it?

EN: You can run START.cpp (recommended) or, in this order, auxxx.cpp, shuffle.cpp and radix.cpp.
RO: Poti sa rulezi START.cpp (recomandat) sau, pe rand, auxxx.cpp, shuffle.cpp si radix.cpp.

EN: START.cpp is the file that "includes" the three files mentioned above, producing the same result like you would run the three file in that order.
RO: START.cpp este fisierul C++ care "include" cele trei fisiere de mai sus, obtinand acelasi rezultat ca si cum ai rula cele trei pe rand.

Info:

EN: Keep in mind that START.cpp does what auxxx.cpp, shuffle.cpp and radix.cpp do in this order.
RO: Tine minte ca START.cpp face acelasi lucri ca si auxxx.cpp, shuffle.cpp si radix.cpp in aceasta ordine.

auxxx.cpp:

EN:
-generates NR_ELEM numbers (517944 elements TESTED ONLY IN START.cpp with the default options, not with the other three C++ files, see the first UPDATE down below) in ascending order (thought it doesn't really matter if it's ascending because shuffle.cpp is shuffling them);
-reads from -----;
-writes in shuffle.in;
RO:
-genereaza NR_ELEM numere (517944 elemente TESTATE DOAR IN START.cpp cu optiunile default, nu si in celelalte trei fisiere C++, vezi primul UPDATE de jos) in ordine crescatoare (nu prea conteaza daca ca e crescator deoarece shuffle.cpp le amesteca);
-citeste din -----;
-scrie in shuffle.in;

shuffle.cpp:

EN:
-shuffles the numbers generated by auxxx.cpp using the Knuth shuffle algorithm;
-reads from shuffle.in;
-writes in radix.in;
RO:
-amesteca numerele pe care le creaza auxxx.cpp folosind algoritmul de amestecare Knuth;
-citeste din shuffle.in;
-scrie in radix.in;

radix.cpp:

EN:
-sorts the numbers shuffled by shuffle.cpp with the radix sort method (by default it sorts by the LSD but it can be changed easily to MSD, contact me if you have trouble);
-reads from radix.in;
-writes in radix.out;
RO:
-sorteaza numerele pe care le-a amesteca shuffle.cpp cu metoda radix (default este dupa LSD dar se poate schimba usor in MSD, contacteaza-ma daca nu iti merge);
-citeste din radix.in;
-scrie in radix.out;

I/O:

INPUT:

EN: Without any modifications, nothing, but auxxx or auxxx and shuffle can be canceled (/commented in START.cpp) if the user wants a custom string of numbers.
RO: Fara modificari, nimic, dar se poate anula (/comenta in START.cpp) auxxx sau auxxx si shuffle, pentru a pune un sir de numere dorit de user.

OUTPUT:

EN: The final output is radix.out, it should be the same with shuffle.in if the sorting/generation was successfully done.
RO: radix.out este cel final, ar trebui fie exact la fel cu shuffle.in daca sortarea/generarea a fost facuta corecta.

Disclaimer(s):

EN: I do not own any unmodified part(s) of the original code(s) from the source(s) below. The license applies only to the modified part(s). You should have a copy of the WTFPL license along with this file.
RO: Nu detin nimic ce este nemodificat din codul/codurile originale din sursa/sursele de mai jos. Licenta se aplica doar la partea/partile modificate din cod/coduri. Ar trebui sa ai o copie a licentei WTFPL impreuna cu acest fisier.

EN: The radix sorting algorithm was modified from Rosetta Code.
RO: Algoritmul de sortare tip radix a fost modificat de pe Rosetta Code.

EN: The shuffling algorithm (Knuth shuffle) was modified also from Rosetta Code.
RO: Algoritmul de amestecare a numerelor (Knuth shuffle) a fost modificat tot de pe Rosetta Code.

Conclusion:

EN: In conclusion, auxxx.cpp, shuffle.cpp and radix.cpp are optional for running correctly, the only necessary files are all the in/out files (except the fact said at the INPUT section, but I don't recommend it) and START.cpp.
RO: In concluzie, auxxx.cpp, shuffle.cpp si radix.cpp sunt optionale pentru a rula corect, cele necesare sunt toate fisierele in/out (in afara de lucrul spus la sectiunea INPUT, dar nu recomand) si START.cpp.

Updates:

UPDATE 23/04/2020:

EN: I've changed almost all declarations integer to long. It seems that this program supports maximum 517944 (TESTED ON MY MACHINE! RESULTS MAY VARY).
RO: Am schimbat mai toate declararile intenger in long. Se pare ca acest program suporta maxim 517944 elemente (TESTATE PE MASINA MEA! REZULTATELE POT VARIA).

UPDATE 26/04/2020 (1/2):

EN: I've formatted the readme better, I'm going to put an english version soon.
RO: Am formatat mai bine readme-ul, urmez sa pun si pe engleza.

UPDATE 26/04/2020 (2/2):

EN: I've added an english translation to the readme and also modified/added some more info.
RO: Am adaugat o traducere in engleza la readme si am mai modificat/adaugat mai multe informatii.