Thread: How do i use Insertion for sorting?

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    1

    How do i use Insertion for sorting?

    Hi 2 those out there. Pls help me out here. Thanks alot for your help!

    MY question is, " How do I use Insertion for sorting numbers?"


    Thanks!

  2. #2

  3. #3
    Open to suggestions Brighteyes's Avatar
    Join Date
    Mar 2003
    Posts
    204
    Here's pseudocode for an insertion sort algorithm
    Code:
    INSERTION(list, left, right)
      FOR step = left, step < right, step = step + 1
        move = list[step]
        // Make room
        FOR i = step, i >= left, i = i - left
          IF move < list[i - left]
            list[i] = list[i - left]
          ELSE
            BREAK
        // Make the move
        list[i] = move;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Quick, Partiotion, and Insertion Sort
    By silicon in forum C++ Programming
    Replies: 0
    Last Post: 05-18-2005, 08:47 PM
  2. Do you know...
    By davejigsaw in forum C++ Programming
    Replies: 1
    Last Post: 05-10-2005, 10:33 AM
  3. Insertion Sort Problem
    By silicon in forum C++ Programming
    Replies: 1
    Last Post: 05-08-2005, 12:30 PM
  4. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  5. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM