Skip to content
Advertisement

How to implement a benchmark for a java mergesort program?

I want to implement a benchmark where the Method MergeSort and it’s performance is measured. I have tried to fill the array that is to be mergesorted with random numbers but when the code is run the array prints the same random number 10 times. Why is this?
PS. I can’t post the entire program I have written. Stackoverflow is saying it’s too much code.

JavaScript

Advertisement

Answer

JavaScript

This loop fills the array with one number 10*m times. That’s why you have the same number for the entire array.

Solution:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement