I'm struggling with my code and was looking for a tutor. Does anyone know of a tutor available?
Thank you!!
OP asked for a tutor to help implement seven sorting algorithms, generate large random data, make multiple copies, and time each sort. offered help and pointed out that posting properly formatted code speeds answers. The quickest path to useful help is a short, reproducible example and clear timing rules; the guidance below focuses on practical, fair benchmarking and common pitfalls that often trip people up.
Use a modern PRNG and a vector as the master data buffer; make copies with vector assignment or std::copy so each algorithm sees the exact same input. Reserve capacity before filling to avoid allocation noise. Prefer std::mt19937 with a fixed seed for reproducible runs (or random_device when unpredictability is required). Example pattern:
std::mt19937 mt(12345);
std::uniform_int_distribution<int> dist(0, 1000000);
std::vector<int> base;
base.reserve(N);
for (size_t i = 0; i < N; ++i) base.push_back(dist(mt));
auto a = base; // repeat to create copies for each algorithm Time only the sort (not I/O or verification) using a monotonic clock and repeat runs. Use std::chrono::steady_clock (or high_resolution_clock where steady is not available), warm up once, run several trials, and take the median to reduce outliers. Verify correctness after sorting with std::is_sorted. Compile with optimization enabled (for example, g++ -std=c++17 -O2) so results reflect real performance.
Watch memory and stack limits when keeping eight full copies of very large arrays; copying costs can be excluded or measured separately depending on assignment rules. If posting code for help, include: minimal code that reproduces the issue, compiler and flags, platform, input sizes, exact error messages or surprising timings, and a short note whether timing should include copy time or not.
Jump to Post— majestic0110 187I could try and help you, I am quite new to C++ myself but have a good background in programming. any particular issues you have ?
I could try and help you, I am quite new to C++ myself but have a good background in programming. any particular issues you have ?
That would be great - I'm having multiple problems!! LOL. I have to write 7 sort programs based of of algorithms. I need to generate random numbers up to 1000000 and sort them. Once the array is created i need to copy it 8 times. I also need to time each sort. I think I have the timing code working, I just need to figure out how to include it in each sort.
I can send you my code and explain what problem I am having at each step, if that would be ok.
The idea of this forum is to post the code here (properly please) and we all get a chance to help you. Be sure to read this first
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.