Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Sorting for C++

This topic is 5235 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does any body know an iterative way to quick sort or to increase the stack flow size.. because right now i am using a recursive quick sort and for large arrays it crashes.. any help would be good

Share this post

Link to post
Share on other sites
You could run a loop and put the current frame being processed in a std::stack. That will move the control information from the stack proper into the heap, which may help your stack overflow problem.

Changing stack space allocated for a process is usually a function of a linker setting. How you change it depends on the linker. For MSVC it''s the /STACK flag.

A better solution is to change from a quick sort to an introspective sort. The standard library std::sort is usually implemented with introspective sorts in most modern standard library implementations.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!