Write a program that correctly implements both the Quicksort and Mergesort algor
ID: 3552282 • Letter: W
Question
Write a program that correctly implements both the Quicksort and Mergesort algorithms.
The program should:
generate an array of 500 random numbers in the 1-100 range.
The program should:
sort the same set of numbers and keep time stamps of how long it takes to sort them. The sorting times of each algorithm should be output when the program finishes.
PLEASE COMPLETE ALL RULES TO COMPLETE ASSIGNMENT. CAN USE JAVA OR C++
Explanation / Answer
#include #include #include #include #include #include std::string gen_random() { size_t len = rand() % 25 + 5; std::string x; std::generate_n(std::back_inserter(x), len, rand); return x; } static const int num = 10000000; int main(){ std::vector strings; std::generate_n(std::back_inserter(strings), num, gen_random); clock_t start = clock(); std::sort(strings.begin(), strings.end()); clock_t ticks = clock() - start; std::coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.