Alphabetizing n words.

This is a discussion on Alphabetizing n words. within the C Programming forums, part of the General Programming Boards category; My question is: What is the best algorithm for alphabetizing strings of chars in C?...

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    23

    Alphabetizing n words.

    My question is:
    What is the best algorithm for alphabetizing strings of chars in C?

  2. #2
    Registered User
    Join Date
    Jan 2006
    Posts
    23
    I know bubble sort has O(n^2) and that is really bad, anyone have an extremely fast way of going about this? (sorting LOTS of strings)

  3. #3
    cwr
    cwr is offline
    Registered Luser cwr's Avatar
    Join Date
    Jul 2005
    Location
    Sydney, Australia
    Posts
    869
    See http://en.wikipedia.org/wiki/Quick_sort.

    The C standard library has a qsort which can be used in conjunction with strcmp for this.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 04:06 PM
  2. seg fault at vectornew
    By tytelizgal in forum C Programming
    Replies: 2
    Last Post: 10-25-2008, 02:22 PM
  3. Problem with malloc() and sorting words from text file
    By goron350 in forum C Programming
    Replies: 11
    Last Post: 11-30-2004, 10:01 AM
  4. New Theme
    By XSquared in forum A Brief History of Cprogramming.com
    Replies: 160
    Last Post: 04-01-2004, 08:00 PM

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