insert sort

This is a discussion on insert sort within the C++ Programming forums, part of the General Programming Boards category; i have a struct struct node { int item; node* next; }; is this the correct implementation of 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, 05:03 AM
  2. insert sort linked list???
    By vanella*Flavor in forum C++ Programming
    Replies: 4
    Last Post: 10-25-2005, 08:42 PM
  3. Replies: 4
    Last Post: 09-10-2005, 02:07 PM
  4. threaded merge sort
    By AusTex in forum Linux Programming
    Replies: 4
    Last Post: 05-04-2005, 05:03 AM
  5. Sorting
    By vasanth in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 11-10-2003, 05:21 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21