Thread: C algorithm

  1. #1
    Registered User
    Join Date
    Apr 2004
    Posts
    22

    C algorithm

    Hello All,

    Can anybody provide me good web link for C algorithm?

    Thanks,
    Happy Man

  2. #2
    Registered User linuxdude's Avatar
    Join Date
    Mar 2003
    Location
    Louisiana
    Posts
    926
    what are you talking about??

  3. #3
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    Algorithm for a C compiler?
    Algorithm for a quicksort in C?
    Algorithm for a function that prints a "C" to the screen?


    What the hell do you want from us?!?!?
    Do not make direct eye contact with me.

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >Can anybody provide me good web link for C algorithm?
    Here, pick one. The implementations aren't all in C, but the coverage is nice. If you want to learn about algorithms then I suggest getting a few books. It's easier than netdiving for ages just to end up with crappy code.
    My best code is written with the delete key.

  5. #5
    Registered User
    Join Date
    Apr 2004
    Posts
    22
    I want to know all sorting algorithm and their comparisn with respect to speed and memory consumption?

  6. #6
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >I want to know all sorting algorithm
    Have fun. Of course, if you only want to know about the more common sorting algorithms, it's easier.

    >and their comparisn with respect to speed and memory consumption?
    Fair enough. Can you describe your data? Type, amount, how it's stored, etc... All of these are factors in choosing a sorting algorithm. But here are a few you can research:

    Bubblesort
    Insertion Sort
    Selection Sort
    Shell Sort
    Merge Sort
    Quick Sort
    Heap Sort
    Tree Sort
    Introspective Sort
    Radix Sort

    They all vary in requirements, speed and implementation, but all have a case where they are most useful. There are many more as well. The topic is just too broad to properly answer your question as you asked it. Can you be more specific?
    My best code is written with the delete key.

  7. #7
    C > C++ duders ggs's Avatar
    Join Date
    Aug 2001
    Posts
    435
    i have done the analysis, hybrid heap-quicksort with an insertion step for n < 5 and merge sort for special runs of m is the best
    .sect signature

  8. #8
    Registered User strontium90's Avatar
    Join Date
    Apr 2004
    Posts
    3
    Hi Happy Man,

    in addition to what's mentioned above, you may want to check http://www.nr.com for numerical algorithms in C.

    -strontium90

  9. #9
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    Quote Originally Posted by ggs
    i have done the analysis, hybrid heap-quicksort with an insertion step for n < 5 and merge sort for special runs of m is the best
    If I may quote your avatar, sir,
    n0 l1f3
    Do not make direct eye contact with me.

  10. #10
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >hybrid heap-quicksort with an insertion step for n < 5 and merge sort for special runs of m
    Which would essentially be one variation of introspective sort.
    My best code is written with the delete key.

  11. #11
    C > C++ duders ggs's Avatar
    Join Date
    Aug 2001
    Posts
    435
    Quote Originally Posted by Prelude
    >hybrid heap-quicksort with an insertion step for n < 5 and merge sort for special runs of m
    Which would essentially be one variation of introspective sort.

    well, that depends on the phase of the moon (all that lunar electrostatic interference)

    edit: to say i am shocked and bemused to see that hybrid quicksort and heapsort is quite well known (!)

    vv
    Last edited by ggs; 04-14-2004 at 12:26 PM.
    .sect signature

  12. #12
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >well, that depends on the phase of the moon (all that lunar electrostatic interference)
    Feh, and here I had been basing my collection of sort algorithms on the alignment of the planets. No wonder I can't shave off those last few clock cycles.
    My best code is written with the delete key.

  13. #13
    The C-er
    Join Date
    Mar 2004
    Posts
    192

    Hello All,

    Can anybody provide me good web link for C algorithm?

    Thanks,
    Happy Man
    Before everyone went off on a tangent, I took this to mean good algorithmS.

    I think all you guys were a bit harsh - You lynch a guy for missing an "s" !

    I don't know of any web links, but if you want a good starting point, "The Art of Computer Programming" series (3 volumes) by Knuth is great, even though it's been around for a while now (30 years I think). I seem to remember the examples are in fortran.

    I found it pretty fascinating (in a nerdy sort of way) when I first came across it. Wish I still had a copy.

  14. #14
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >I think all you guys were a bit harsh
    Not all of us, thank you very much.

    >"The Art of Computer Programming" series (3 volumes) by Knuth is great
    Definitely. Though not for the weak of heart.

    >even though it's been around for a while now (30 years I think).
    They're being updated. My most recent copies are copyrighted 1998.

    >I seem to remember the examples are in fortran.
    Fictitious ASM called MIX invented by Knuth for the books.

    >Wish I still had a copy.
    I haven't been to a bookstore in ages that didn't have at least one volume.
    My best code is written with the delete key.

  15. #15
    The C-er
    Join Date
    Mar 2004
    Posts
    192
    >I think all you guys were a bit harsh
    Not all of us, thank you very much.

    I was excluding you by default of course, Prelude. (Yeah, yeah, and all you other "nice" people)

    >even though it's been around for a while now (30 years I think).
    They're being updated. My most recent copies are copyrighted 1998.

    Woohoo ! - I'll definitely purchase said items once funds are available.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Implement of a Fast Time Series Evaluation Algorithm
    By BiGreat in forum C Programming
    Replies: 7
    Last Post: 12-04-2007, 02:30 AM
  2. Replies: 4
    Last Post: 12-10-2006, 07:08 PM
  3. 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
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM