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 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
The Common Lisp HyperSpec says in the funcall entry that (funcall function arg1 arg2
A common pattern in C++ is to create a class that wraps a lock
A common argument against using .NET for high volume, transactional enterprise systems is that
My common usecase for my Struts2 application is that I have Actions that collect
A common pattern within jQuery is a method that takes a callback which is
Common question but I could use an english explanation. Is it like Java where
A common task in programs I've been working on lately is modifying a text
With common lisp and I am assuming the introspection properties. How can I add
A common mistake when configuring the compilation/linking/etc. settings in VC++ 2008 is to set

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.