jump to navigation

Sorting Algorithm Animations March 23, 2015

Posted by sandyclaus in Academic Technology, Computer Security.
trackback

These pages show 8 different sorting algorithms on 4 different initial conditions. These visualizations are intended to:

Show how each algorithm operates.

Show that there is no best sorting algorithm.

Show the advantages and disadvantages of each algorithm.

Show that worse-case asymptotic behavior is not always the deciding factor in choosing an algorithm.

Show that the initial condition (input order and key distribution) affects performance as much as the algorithm choice.

The ideal sorting algorithm would have the following properties:

Stable: Equal keys aren’t reordered.

Operates in place, requiring O(1) extra space.

Worst-case O(n·lg(n)) key comparisons.

Worst-case O(n) swaps.

Adaptive: Speeds up to O(n) when data is nearly sorted or when there are few unique keys.

There is no algorithm that has all of these properties, and so the choice of sorting algorithm depends on the application.

Sorting is a vast topic; this site explores the topic of in-memory generic algorithms for arrays. External sorting, radix sorting, string sorting, and linked list sorting—all wonderful and interesting topics—are deliberately omitted to limit the scope of discussion

via Sorting Algorithm Animations.

Advertisements

Comments»

No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: