Skip to content

Conversation

@SebastianMenzelSAP
Copy link

In reviewing the benchmark_numbers.cpp file, I noticed that the functions Generator_sorted_middle and Generator_reversed_sorted_middle have identical definitions. Additionally, certain parts of these functions' code lack coherence. I am proposing a resolution for these issues.

Problems Identified:

  1. The method Generator_reversed_sorted_middle currently sorts the elements after swapping them, contradicting the intention of a reversed sort ( l. 246 - 247 ). In Generator_reversed_sorted_middle the swapping also happens, with no use afterwards ( l. 188 - 189).

  2. The Generator_sorted_middle and Generator_reversed_sorted_middle functions generate more elements compared to other methods. For instance, the Generator_sorted_middle function generates 100200000 elements when running sorted + 0.1% end, while other functions generate only 100100000. This unequal element generation inhibits fair comparison between different algorithms.

  3. The algorithm execution leads to an out of bound access at lines 199 and 257.

Proposed Solution:
I have made adjustments to address these issues. The changes lead to more consistent and accurate benchmark tests between sorting algorithms. I look forward to feedback on my proposed revisions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants