I do a sorting visualizer in c ++, can I use the usual sorting algorithms to sort the array step by step, i.e. after one step, one frame is drawn.

  • one
    What does "ordinary sorting algorithms" mean? If you're talking about the standard library - no, you can't. If you are talking about your implementation of some algorithms, then you can, of course. - RiotBr3aker September

1 answer 1

Yes you can.

Take the code of any sorting algorithm and after each exchange of values ​​draw a state (with a pause and highlighting of the exchanged elements, if you need).

  • Thanks, of course, I just thought you could use native tools stl - ishidex2
  • @Duoxx STL doesn’t exactly provide this; Any sorting is sharpened primarily on performance, and not on the callback call every step. - Kromster