Thread: insert sort

  1. #1
    Unregistered
    Guest

    insert sort

    i have a struct
    struct node
    {
    int item;
    node* next;
    };

    is this the correct implementation of insert sort
    void insertsort(struct node ** headref){
    struct node* result = NULL;
    struct node* current = *headref;
    struct node* next;
    while (current !=NULL){
    next = current->next;
    sortedinsert(&result, current);
    current = next;
    }
    *headref = result;
    }

  2. #2
    Unregistered
    Guest
    Here is code of the insertion sort:
    http://www.cpp-home.com/code.php?68_1

    Ilia Yordanov,
    www.cpp-home.com ; C++ Resources

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Straight Insertion Sort function problem
    By StaticKyle in forum C++ Programming
    Replies: 6
    Last Post: 05-12-2008, 04:03 AM
  2. insert sort linked list???
    By vanella*Flavor in forum C++ Programming
    Replies: 4
    Last Post: 10-25-2005, 07:42 PM
  3. Replies: 4
    Last Post: 09-10-2005, 01:07 PM
  4. threaded merge sort
    By AusTex in forum Linux Programming
    Replies: 4
    Last Post: 05-04-2005, 04:03 AM
  5. Sorting
    By vasanth in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 11-10-2003, 05:21 PM