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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:04:10+00:00 2026-05-13T00:04:10+00:00

There’s a (relatively) new sort on the block called Timsort. It’s been used as

  • 0

There’s a (relatively) new sort on the block called Timsort. It’s been used as Python’s list.sort, and is now going to be the new Array.sort in Java 7.

There’s some documentation and a tiny Wikipedia article describing the high-level properties of the sort and some low-level performance evaluations, but I was curious if anybody can provide some pseudocode to illustrate what Timsort is doing, exactly, and what are the key things that make it zippy. (Esp. with regard to the cited paper, “Optimistic Sorting and Information Theoretic Complexity.”)

(See also related StackOverflow post.)

  • 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-13T00:04:11+00:00Added an answer on May 13, 2026 at 12:04 am

    Quoting the relevant portion from a now deleted blog post: Visualising Sorting Algorithms: Python’s timsort

    The business-end of timsort is a mergesort that operates on runs of pre-sorted elements. A minimum run length minrun is chosen to make sure the final merges are as balanced as possible – for 64 elements, minrun happens to be 32. Before the merges begin, a single pass is made through the data to detect pre-existing runs of sorted elements. Descending runs are handled by simply reversing them in place. If the resultant run length is less than minrun, it is boosted to minrun using insertion sort. On a shuffled array with no significant pre-existing runs, this process looks exactly like our guess above: pre-sorting blocks of minrun elements using insertion sort, before merging with merge sort.

    […]

    • timsort finds a descending run, and reverses the run in-place. This is done directly on the array of pointers, so seems “instant” from our vantage point.
    • The run is now boosted to length minrun using insertion sort.
    • No run is detected at the beginning of the next block, and insertion sort is used to sort the entire block. Note that the sorted elements at the bottom of this block are not treated specially – timsort doesn’t detect runs that start in the middle of blocks being boosted to minrun.
    • Finally, mergesort is used to merge the runs.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

there is an array in c# string[] arr = new string[] {1,A,D,3,5,AF,34,TU,E,OP,4}; so how
There have been several questions on SO regarding getting Contacts numbers using the Contacts
There are many string matching algorithms can be used to find a pattern (string)
There is a website called Gild.com that has different coding puzzles/challenges for users to
There is probably an easy answer for this, but when I added DateTime.Now.ToString() to
There seem to be many ways to define singletons in Python. Is there a
There are numerous Agile software development methods. Which ones have you used in practice
There is a method in the Messages class called questionWhatisYourName() this method is called
There is this SQL Statement SELECT t1.Name ,Count(t2.SubID) Totals -- I don't know how
There are numerous places on the Internet, suggesting that it is easily achieved by

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.