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 8669673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:32:01+00:00 2026-06-12T18:32:01+00:00

I was curious to know how to select a sorting algorithm based on the

  • 0

I was curious to know how to select a sorting algorithm based on the input, so that I can get the best efficiency.

Should it be on the size of the input or how the input is arranged(Asc/Desc) or the data structure used etc … ?

  • 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-12T18:32:02+00:00Added an answer on June 12, 2026 at 6:32 pm

    The importance of algorithms generally, and in sorting algorithms as well is as following:

    (*) Correctness – This is the most important thing. It worth nothing if your algorithm is super fast and efficient, but is wrong. In sorting, even if you have 2 candidates that are sorting correctly, but you need a stable sort – you will chose the stable sort algorithm, even if it is less efficient – because it is correct for your purpose, and the other is not.

    Next are basically trade offs between running time, needed space and implementation time (If you will need to implement something from scratch rather then use a library, for a minor performance enhancement – it probably doesn’t worth it)

    Some things to take into consideration when thinking about the trade off mentioned above:

    1. Size of the input (for example: for small inputs, insertion sort is empirically faster then more advanced algorithms, though it takes O(n^2)).
    2. Location of the input (sorting algorithms on disk are different from algorithms on RAM, because disk reads are much less efficient when not sequential. The algorithm which is usually used to sort on disk is a variation of merge-sort).
    3. How is the data distributed? If the data is likely to be “almost sorted” – maybe a usually terrible bubble-sort can sort it in just 2-3 iterations and be super fast comparing to other algorithms.
    4. What libraries do you have already implemented? How much work will it take to implement something new? Will it worth it?
    5. Type (and range) of the input – for enumerable data (integers for example) – an integer designed algorithm (like radix sort) might be more efficient then a general case algorithm.
    6. Latency requirement – if you are designing a missile head, and the result must return within specific amount of time, quicksort which might decay to quadric running time on worst case – might not be a good choice, and you might want to use a different algorithm which have a strict O(nlogn) worst case instead.
    7. Your hardware – if for example you are using a huge cluster and a huge data – a distributed sorting algorithm will probably be better then trying to do all the work on one machine.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that questions should have definitive answers, but I'm legitimately curious to get
Select all the CSS hack(s) that IE6 can understand for class red <p class=red>text</p>
I'm probably answering my own question, but I'm extremely curious. I know that CSS
Using Flask, I'm curious to know if SQLAlchemy is still the best way to
I'm curious to know what the best way (best practice) to handle hierarchies are
I know you can use LIKE for a select statement to search for a
I curious to know how the jQuery.load functionality affects page load speeds when reporting
I'm curious to know how the passwords in linux are maintained in /etc/shadow. Even
I'm curious to know why the C# compiler only gives me an error message
I'm curious to know if multiple images actually show up in the feed. I

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.