Sorting Algorithm with C++

Cerrado Publicado hace 6 años Pagado a la entrega
Cerrado Pagado a la entrega

Homework – Sorting is fun

Record all the timings on the machines from the lab. Always check that you are the only person using that specific machine. You can look at the processes by using the commands top or htop. The only proces that uses more than 10 %CPU or 10 %MEM should be yours.

1. Investigate the execution time for sorting a vector (e.g. std::sort) for different op- timization options (try atleast -O0 and -O3). Sort an uniformly distributed vector of real values between 0 and r with r a chosen range variable (v[i] ∈ [0, r)). You can use the following commands assuming v is the vector of doubles

std::random_device rd;

std::mt19937 generator(rd());

std::uniform_real_distribution<> distribution(0, r);

for(auto& vi:v){

vi=distribution(generator);

}

Use the same framework as before with command line arguments for the size of the vector, the range, the number of experiments and the number of discarded timings. Shuffle the vector before each experiment. Create a graph of the execution time in function of the size of the vector for different compile options.

2. Implement bucket sort ([login to view URL]) which basically first places the elements in buckets, next each bucket is sorted and finally the sorted bucket elements are placed back in the original vector. Use an extra command line argument m for the number of buckets. Suppose the range r of the vector is 1000 and 10 buckets are used, the range for each bucket is 100. This means bucket 0 contains elements in [0, 100), bucket 1 [100, 200), ... and bucket 9 [900, 1000).

Hints:

• Interesting functions are std::ceil and std::floor

• Type conversion or type casting can be done by (type). This can be useful since

dividing two integers results in an integer value.

3. Compare your implementation of bucket sort with the standard sorting algorithm. What is the function of the number of buckets m. What are the advantages/disadvan- tages of both algorithms. Illustrate your explanation with (approximate) algorithmic complexities.

Algoritmos Programación en C Programación en C# Programación en C++ Arquitectura de software

Nº del proyecto: #15512726

Sobre el proyecto

8 propuestas Proyecto remoto Activo hace 6 años

8 freelancers están ofertando un promedio de €36 por este trabajo

utkarshkatiyar19

hi. i have good experience of working on Linux systems and working with sorting algorithms, so i can do it Relevant Skills and Experience Algorithm Proposed Milestones €50 EUR - all

€50 EUR en 1 día
(431 comentarios)
7.4
harshdaga

Hi, I've got quite some experience with C++ and I'm sure I can help you out with your project. May I get more details over the chat? Relevant Skills and Experience C, C++, Algorithms Proposed Milestones €23 EUR - Co Más

€23 EUR en 1 día
(93 comentarios)
5.6
UsamaIshfaq

I am good at Data Strcuture and Algorithm. I have made similar assignment for my DSA subject in C++. I can do the same task for you. Please assign me the project. There will be only 1 milestone. Relevant Skills and E Más

€55 EUR en 3 días
(1 comentario)
0.7
Erjhio

I can help you I have a lot of experience with C/C++ Relevant Skills and Experience I master C/C++ Proposed Milestones €19 EUR - OK

€19 EUR en 1 día
(0 comentarios)
0.0