JavaScript
  Home arrow JavaScript arrow Page 2 - Quicksort
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

Quicksort
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 3
    2008-10-20

    Table of Contents:
  • Quicksort
  • Tutorial Approach
  • The Quicksort Algorithm
  • Quicksort by Observation
  • Computer Implementation

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Quicksort - Tutorial Approach


    (Page 2 of 5 )

    You can sort an array of strings in ascending order (as in the dictionary) or in descending order (opposite to a dictionary's format). I will consider only the ascending order in this article.

    Well, in an array of data (strings), it is possible to have two or more data items (strings) which are the same. So I will use the term “non-decreasing” instead of “ascending” to allow for data items that are the same.

    I will first describe the algorithm. Normally, you sort an array of strings, not an array of letters from the alphabet. I use letters from the alphabet to do most of the explanation in this article. At the end of the article, I show how the function works with an array of strings.

    After describing the algorithm, I explain how the computer can implement the algorithm. The implementation I give in this article is my own implementation. There are other implementations; I will not talk about those. I then write the function in JavaScript. I explain everything step by step.

    We shall sort the following list before we consider strings:

    Q, W, E, R, T, Y, U, I, O, P

    The counting of array (list) elements is always done from position zero. So in the above list; Q is in position 0; W is in position 1; E is in position 2 and so on with P in position 9. There are 10 elements all together.

    More JavaScript Articles
    More By Chrysanthus Forcha


       · It is good to understand the operation of the Quicksort function. I did this in...
     

    JAVASCRIPT ARTICLES

    - Comparing Fields and Customizing Error Messa...
    - Checking Numbers and File Extensions with jQ...
    - Validating Digits and Dates with jQuery`s Va...
    - Validating Ranges, Emails, and URLs with jQu...
    - More Uses for the jQuery Tooltip Plug-in`s b...
    - Building Image-Based Tooltips with the jQuer...
    - Using the jQuery Tooltip Plug-in`s bodyHandl...
    - Using Rangelength, Min and Max with the Vali...
    - Using Minlength and Maxlength with the Valid...
    - Modifying Tooltip Coordinates with the jQuer...
    - Applying a Fade Out Effect with the jQuery T...
    - Tracking Mouse Movements with the jQuery Too...
    - Checking Online Forms with the Validator jQu...
    - Nested JavaScript Functions as Objects
    - The jQuery Tooltip Plug-in







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek