Hypography Science Forums: Smooth Sort - Hypography Science Forums

Jump to content

Welcome! You are currently viewing the Hypography Science Forum as a guest. In order to participate in our science discussions, you should register now! Registration is free and you can use your Facebook login if you like.
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Smooth Sort best sorting algorithm? Rate Topic: -----

#1 User is offline   phillip1882 

  • Thinking
  • Group: Members
  • Posts: 421
  • Joined: 19-July 08

Posted 14 December 2011 - 12:27 PM

so i was bored out of my mind and took the time to try writing a python version of every sorting algorithm i could find.
quicksort, mergesort, heapsort, shellsort, combsort, you name it.
the one that was the most challange was smoothsort. this bugger took me 4 hours to get working properly; the longest time i have ever spent trying to program a sort. it's a fairly neat algorithm. basically it creates a pseudo heap, with the largest element in the proper place, and then deques elements form that heap one at a time, swapping each element with any lower larger elements.
you can read up on it here if you're interested in the working of the algorithm.
the primary advantage of it is that it's n lg n complexity in the worst case, and aproaches n complexity if the array is nearly sorted.
here's my code if you're interested.
Spoiler

0

#2 User is offline   phillip1882 

  • Thinking
  • Group: Members
  • Posts: 421
  • Joined: 19-July 08

Posted 14 December 2011 - 04:08 PM

Attached Image: smooth1.gif
here's an animation i made that demonstrates the process.
yeah, still pretty bored.

edit: uploaded slightly larger animation.

Attached thumbnail(s)

  • Attached Image: 577802.gif

0

#3 User is offline   phillip1882 

  • Thinking
  • Group: Members
  • Posts: 421
  • Joined: 19-July 08

Posted 17 December 2011 - 09:26 PM

bah, always a bug. :rolleyes:
Spoiler

0

#4 User is offline   JMJones0424 

  • ~3720:1
  • View gallery
  • Group: Members
  • Posts: 609
  • Joined: 13-February 09

Posted 18 December 2011 - 01:33 AM

While wondering aimlessly through youtube I occasionally stumble upon excellent illustrations of concepts that are of little use to me, but I hang on to them in the hope that they may be valuable to someone in the future. Perhaps you'll enjoy this animation comparing quick sort and bubble sort.


Acts of creation are ordinarily reserved for gods and poets. To plant a pine, one need only own a shovel. - Aldo Leopold
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users


View our Science Quizzes | Science links. About the Hypography Science Forums

Friends

We recommend these stellar sites:

PC Help Forum

ATL - Atlanta Computer Repair

Sponsors

Hypography?

Hypography [n.]: A combination of "hyperlink" and "bibliography" - ie, a list of links to electronic documents. Comparable to discography and bibliography, but not cartography.

When we launched in May 2000, we wanted to create a site to share science-related content of all kinds on the web. As time passed, our site turned into a pure science forum with lots of cool people.

So we kept the name Hypography and the cool science forum community - and aim to be a friendly place for discussion of science topics of all kinds.