insertion sort


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: insertion sort

  1. #1
    Join Date
    Nov 2004
    Posts
    19

    insertion sort

    can you help me, how do i implement the insertion sort algorithm? as simple as possible acting on an array array

  2. #2
    Join Date
    Sep 2004
    Posts
    150
    Don't take this the wrong way, but It's hard to help you on this without doing the whole thing for you. I'll just say this:

    What is the algorithm?

    Given an array of items to be sorted:

    1) Make a secondary array (of equal size) to store the sorted list.

    2) Find the smallest value in the original array.

    3) Stick that smallest value in the secondary array.

    4) Delete that smallest value from the original array so it isn't used again.

    5) Repeat starting at step 2 until the original array is empty.

    6) The secondary array is now fully sorted.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center