How can i run this code for 20 times, then take the average (20times) of Merge sort and Quick sort ? Help please 🖐️ Just ideas) | Sololearn: Learn to code for FREE!
+ 1

# How can i run this code for 20 times, then take the average (20times) of Merge sort and Quick sort ? Help please 🖐️ Just ideas)

https://code.sololearn.com/cQVSliIV0ZXW/?ref=app

8th Nov 2021, 5:14 PM
Parham
+ 3
Parham that's only pseudo code. You have to make a real C code from that. All what you have to do is: Let both of your algorithm 20 times run and get the time for that. Sum up the time for every run, or get the start time at the beginn of to 20 loops and at the end of the 20 loops. Then divide it by 20. That's all.
8th Nov 2021, 6:52 PM
Coding Cat
+ 3
Just do: timeSum = 0 For i = 0, i<20, i++ startT run algorithm stopT timeSum += stopT - startT time Avg = timeSum / 20
8th Nov 2021, 6:13 PM
Coding Cat
+ 3
Parham Parham look at this. But be careful. I did this for the first time. And I am not a C specialist. And the result amazes me. Are you sure the sorting algorithms are working well? There is a very large time difference between the two. https://code.sololearn.com/cMGeyo596f9R/?ref=app
8th Nov 2021, 8:20 PM
Coding Cat
+ 2
There will be answere yo take average from then ..... This line is not clear or given any example
8th Nov 2021, 5:29 PM
A S Raghuvanshi
+ 2
Do an internet search for: c++ measuring execution time
8th Nov 2021, 5:58 PM
Simon Sauter
+ 1
Your question is not clear rewrite in easy way what actually u want i think are talking about the running time of both algorithms
8th Nov 2021, 5:23 PM
A S Raghuvanshi
0
The teacher said you got to run this and there will be answers to take average from then , are you saying sould i give the code time to get different responds ? ♨️A.S.♨️
8th Nov 2021, 5:27 PM
Parham
0
I mean , the teacher said we should run this code 20 times, and for example numbers will be 15 for QS and 8 for MS . Next run other answers and .... Then take average of 20 time running (20 QS answers & 20 MS answers) the algorithm in Excel , i think i said it right ♨️A.S.♨️ by the way tnx for ur time
8th Nov 2021, 5:37 PM
Parham
0
♨️A.S.♨️ It's not about excel , just the code , can i get different answers by 20 times running the code? What's your opinion https://code.sololearn.com/cQVSliIV0ZXW/?ref=app
8th Nov 2021, 5:44 PM
Parham
0
Coding Cat Couldn't do much with the change
8th Nov 2021, 6:24 PM
Parham
0
Martin Taylor Thank for your checking and opinion 🙌 I gotta work more on it )
11th Nov 2021, 2:40 PM
Parham
0
Coding Cat thanks you that you have witten a code 🙌🪶and your right it's a lot of difference between answers that code says Parham Parham look at this. But be careful. I did this for the first time. And I am not a C specialist. And the result amazes me. Are you sure the sorting algorithms are working well? There is a very large time difference between the two. https://code.sololearn.com/cMGeyo596f9R/?ref=app
11th Nov 2021, 2:47 PM
Parham