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

  • SEARCH
  • Home
  • 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 315079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:15:31+00:00 2026-05-12T08:15:31+00:00

The common wisdom says that for small enough arrays insertion sort is the best.

  • 0

The common wisdom says that for small enough arrays insertion sort is the best. E.g., Timsort uses (binary) insertion sort for arrays up to 64 elements; from Wikipedia:

Some divide-and-conquer algorithms such as quicksort and mergesort sort by recursively dividing the list into smaller sublists which are then sorted. A useful optimization in practice for these algorithms is to use insertion sort for sorting small sublists, as insertion sort outperforms these more complex algorithms. The size of list for which insertion sort has the advantage varies by environment and implementation, but is typically between eight and twenty elements.

Is this actually correct? Are there any better alternatives?

In case this depends significantly on platform, I am most interested in .NET.

  • 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-05-12T08:15:31+00:00Added an answer on May 12, 2026 at 8:15 am

    Yes, this is what I’ve learned in my algorithms classes, and this is also how sort is implemented in the C++ STL. From Wikipedia:

    The June 2000 SGI C++ Standard
    Template Library stl_algo.h
    implementation of unstable sort uses
    the Musser introsort approach with the
    recursion depth to switch to heapsort
    passed as a parameter, median-of-3
    pivot selection and the Sedgewick
    final insertion sort pass. The element
    threshold for switching to the simple
    insertion sort was 16.

    I did some informal performance tests last year and C++ STL std::sort was about twice as fast as Array.Sort in .NET. I don’t know how .NET Array.Sort is implemented, but in .NET, an access in an array requires a bounds check, unlike in C++, which could largely account for the performance difference.

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

Sidebar

Related Questions

It's my understanding that common wisdom says to only use exceptions for truly exceptional
Common scenario: I have a library that uses other libraries. For example, a math
A common question that comes up from time to time in the world of
Common Lisp HyperSpec says that require and ****modules**** are deprecated. But I still see
The Common Lisp HyperSpec says in the funcall entry that (funcall function arg1 arg2
Exceptions cause Node.js servers to crash. The common wisdom is that one needs to
I am using ASP.Net with jquery/javascript. Common wisdom seems to dictate that the javascript
A common mistake when writing code that reads text from a stream in Java
Common Lisp has return-from ; is there any sort of return in Clojure for
A common problem is that for validation you need to run the same code

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.