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.
1 answer
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
|