How can I force a display refresh?

I am trying to animate sorting algorithms to visualize them, I would like to refresh the display (i.e. run the draw function) every time the array is modified, how would I go about doing that? Since redraw() only sets a flag, it waits for the whole sorting to be finished before refreshing which is completely against the point. I'd also like the method to be easily applicable to any sorting algorithm regardless of implementation. Ideally I'd like for the sorting algorithm to hang until the refresh is complete so that every array modification shows at least for one frame.

Answers

Sign In or Register to comment.