I guess it is postoffice shorting, does anyone know the algorithm?(need a simplified version)

Recommended Answers

All 3 Replies

You may find this article interesting

>need a simplified version
That's easy, there's no such thing. Be specific about the context in which the algorithm would be used and an efficient one can be suggested.

Generally speaking, it's whichever algorithm takes the most advantage of hardware. For example, people pretend that bucket sort takes linear time, but it really takes O((n+k) log k) time, where k is the number of distinct elements. They pretend it takes linear time because for values of n and k that are less than a billion, the log(k) factor fits inside one machine code instruction. The reason quicksort is faster than heapsort is that it takes advantage of the cache. Or it's that heapsort doesn't. Similarly, you'll find that insertion sort goes much faster for sorting a deck of cards than merge sort does, but quicksort still comes out on top.

Postman's sort is available online; find it yourself.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.