What is the best way to sort a collection while updating a progress bar? Currently I have code like this:
for (int i = 0; i < items.size(); i++)
{
pro
If you're just comparing sort times, print the time before and after the sort.
Predicting how long a sort in the wild will take is difficult. For some sorts it depends on the ordering of the input. I'd use i/(double) items.size()
to generate a ratio of the work done and call it a fine day. You might choose to update the bar every items.size()/100
iterations. There no reason to slam the poor progress bar with useless updates.