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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:15:33+00:00 2026-06-05T19:15:33+00:00

The name says it all really. I suspect that insertion sort is best, since

  • 0

The name says it all really. I suspect that insertion sort is best, since it’s the best sort for mostly-sorted data in general. However, since I know more about the data there is a chance there are other sorts woth looking at. So the other relevant pieces of information are:

1) this is time data, which means I presumable could create an effective hash for ordering of data.
2) The data won’t all exist at one time. instead I’ll be reading in records which may contain a single vector, or dozen or hundreds of vectors. I want to output all time within a 5 second window. So it’s possible that a sort that does the sorting as I insert the data would be a better option.
3) memory is not a big issue, but CPU speed is as this may be a bottleneck of the system.

Given these conditions can anyone suggest an algorithm that may be worth considering in addition to insertion sort? Also, How does one defined ‘mostly sorted’ to decide what is a good sort option? What I mean by that is how do I look at my data and decided ‘this isn’t as sorted as I thought it as, maybe insertion sort is no longer the best option’? Any link to an article which considered process complexity which better defines the complexity relative to the degree data is sorted would be appreciated.

Thanks

Edit:
thank you everyone for your information. I will be going with an easy insertion or merge sort (whichever I have already pre-written) for now. However, I’ll be trying some of the other methods once were closer to the optimization phase (since they take more effort to implement). I appreciate the help

  • 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-05T19:15:35+00:00Added an answer on June 5, 2026 at 7:15 pm

    You could adopt option (2) you suggested – sort the data while you insert elements.

    Use a skip list, sorted according to time, ascending to maintain your data.

    • Once a new entree arrives – check if it is larger then the last
      element (easy and quick) if it is – simply append it (easy to do in a skip list). The
      skip list will need to add 2 nodes on average for these cases, and will be O(1) on
      average for these cases.
    • If the element is not larger then the last element – add it to the
      skip list as a standard insert op, which will be O(logn).

    This approach will yield you O(n+klogn) algorithm, where k is the number of elements inserted out of order.

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

Sidebar

Related Questions

The name says it all, but to elaborate I have a list of vectors
I have static method which returns me as it's name says data from domain
PEP 8 says that Python package and module names should be short, since some
the question says it all. Can someone please tell me if that is possible
i have a string: String value = (name) Says: hello (/name); where name could
The manual does not answer this question : it says the name of the
using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; VS says, The type or namespace name 'Formatters' does not
Name: <%= Html.TextBox(txtName, 20, new { @class = hello }) %> I want that
As the title says, I want to have a build tool that quite much
As the title says really. I want to enable sharing user generated content easily

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.