Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9209619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:53:11+00:00 2026-06-18T00:53:11+00:00

Mergesort, quicksort are probably most known nlogn sorting algorithms. Their explanation and c++ code

  • 0

Mergesort, quicksort are probably most known nlogn sorting algorithms. Their explanation and c++ code examples in most cases contains recursion. But as far as I understand about recursion when it will be big amount of data we run big risk of stack overflow. So is it reasonable to ignore recursion explanation about sorting algorithms as such that can’t be use in real life?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T00:53:12+00:00Added an answer on June 18, 2026 at 12:53 am

    But as far as I understand about recursion when it will be big amount of data we run big risk of stack overflow.

    It depends on several things:

    • Tail calls are nearly always optimized these days, so you would never hit stack overflow with tail recursion, even if you recurse O(2^N) times (the algorithm would still be slow, but it wouldn’t overflow the stack).
    • Most sorting algorithms recurse down Log2(N) times. This comes up to 40 levels per terabyte of data being sorted – not enough to overflow a stack of anything capable of holding a terabyte of data in its memory.

    is it reasonable to ignore recursion explanation about sorting algorithms as such that can’t be use in real life?

    No, it is not reasonable to ignore these explanations: if an algorithm is logically recursive, the best explanation will also be recursive. Even if you implement the algorithm with a loop that uses a dynamically allocated stack to avoid stack overflows, the nature of the algorithm would remain recursive, so the best way to understand what’s going on is to pretend that a recursive call is made.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Algorithms like Timsort, Quicksort & Mergesort dominate the real world sorting methods. The case
I'd like to create various sorting classes (QuickSort, MergeSort, BucketSort...etc). I have a common
from wiki page of insertion sort: Some divide-and-conquer algorithms such as quicksort and mergesort
Why is mergesort considered the way to go when sorting lists and not quicksort?
I've seen many mergesort implementations. Here is the version in Data Structures and Algorithms
I want to compare count of operations of the sorting algorithms Merge Sort and
How are algorithms analyzed? What makes quicksort have an O(n^2) worst-case performance while merge
I have written the following mergesort code. public class mergesort { public static int
I have written an in place mergesort algorithm for sorting a large set of
I have a linked list implementation and I'm experimenting with both MergeSort and QuickSort

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.