DaemonForums  

Go Back   DaemonForums > Miscellaneous > Programming

Programming C, bash, Python, Perl, PHP, Java, you name it.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 3rd November 2008
JMJ_coder JMJ_coder is offline
VPN Cryptographer
 
Join Date: May 2008
Posts: 464
Thanked 8 Times in 8 Posts
Default Data Structures in C

Hello,

Can anyone recommend a good comprehensive book or reference on data structures and their implementations in the C programming language? I don't really need an introductory work, as I have one for C++ - but I'm looking for a more advanced and comprehensive work.
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14)
Reply With Quote
  #2   (View Single Post)  
Old 3rd November 2008
mdh's Avatar
mdh mdh is offline
Real Name: Matt D. Harris
FreeBSD 2.2.6 User
 
Join Date: Oct 2008
Location: West Virginia
Posts: 139
Thanked 8 Times in 8 Posts
Default

Data structures as in... things defined using ''struct''?
Can you be a bit more specific in terms of what information you're looking for?
Reply With Quote
  #3   (View Single Post)  
Old 3rd November 2008
JMJ_coder JMJ_coder is offline
VPN Cryptographer
 
Join Date: May 2008
Posts: 464
Thanked 8 Times in 8 Posts
Default

Quote:
Originally Posted by mdh View Post
Data structures as in... things defined using ''struct''?
Can you be a bit more specific in terms of what information you're looking for?
Examples: linked lists, binary search trees, stacks, queues, etc.
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14)
Reply With Quote
  #4   (View Single Post)  
Old 3rd November 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Thanked 112 Times in 104 Posts
Default

Well, it might sound stupid, but I learned how to implement such things using Wikipedia, GCC, and GDB lol. Lists, Stacks, and Queues are all similar enough that if you figure out how to implement one, the others should fall into place quick enough. Tree structures on the other hand can be a bit tricky at first. The main difference from C++ implementations, you won't find OO syntax used even though some C programs are written in an object oriented style. That, and there is no STL... lol.


For books, I have never read it but [http://oreilly.com/catalog/9781565924536/]Mastering Algorithms with C[/url] from O'Reilly might be a good buy.
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.

Last edited by TerryP; 3rd November 2008 at 05:28 AM.
Reply With Quote
  #5   (View Single Post)  
Old 3rd November 2008
anemos's Avatar
anemos anemos is offline
Fdisk Soldier
 
Join Date: May 2008
Location: Ελλάδα
Posts: 53
Thanked 5 Times in 5 Posts
Default

Quote:
Originally Posted by TerryP View Post
Lists, Stacks, and Queues are all similar enough that if you figure out how to implement one, the others should fall into place quick enough.
I don't think that data structures are very similar to each other in the way that each one is used into different cases. Data structures can be divided into two major categories, static (stack, queue, even an array is a data structure) and dynamic (linked-lists, trees, graphs) although someone can implement them statically (adjacency matrices for graphs etc). To my knowledge there are not many books that are language-centric because such a topic can be only "seen" algorithmicaly.

The difficult thing for someone when working with complex data structures is to design effective-efficient-reusable-as_fast_as_possible algorithms. The actual implementation/code is the easy part.

A book that I am aware of as great but haven't read it yet is Algorithms + Data Structures = Programs but i think that the algorithms are presented into pseudocode.

You can also have a look at /usr/include/sys/queue.h

Last edited by anemos; 3rd November 2008 at 11:53 AM.
Reply With Quote
  #6   (View Single Post)  
Old 3rd November 2008
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 2,904
Thanked 190 Times in 160 Posts
Default

Quote:
Originally Posted by JMJ_coder View Post
Can anyone recommend a good comprehensive book or reference on data structures and their implementations in the C programming language?
It sounds like you are wanting something akin to Numerical Recipes:

http://www.amazon.com/exec/obidos/tg...X0DER&v=glance

However, note that good books on data structures will be language agnostic (as they should be...). If you are wanting meaty, comprehensive, & dense, Cormen's Introduction to Algorithms is perhaps the best:

http://www.amazon.com/Introduction-A...5736157&sr=1-1

Note that Cormen, et. al. approaches both algorithms & the data structures needed to implement such algorithms from a traditional mathematical standpoint. As such, this book is frequently used in graduate-level coursework. It is also a timeless text, much in the same manner as Knuth's The Art of Computer Programming:

http://www.amazon.com/Art-Computer-P...5736409&sr=1-1
Reply With Quote
  #7   (View Single Post)  
Old 4th November 2008
JMJ_coder JMJ_coder is offline
VPN Cryptographer
 
Join Date: May 2008
Posts: 464
Thanked 8 Times in 8 Posts
Default

Quote:
Originally Posted by ocicat View Post
It sounds like you are wanting something akin to Numerical Recipes:

http://www.amazon.com/exec/obidos/tg...X0DER&v=glance

However, note that good books on data structures will be language agnostic (as they should be...). If you are wanting meaty, comprehensive, & dense, Cormen's Introduction to Algorithms is perhaps the best:

http://www.amazon.com/Introduction-A...5736157&sr=1-1

Note that Cormen, et. al. approaches both algorithms & the data structures needed to implement such algorithms from a traditional mathematical standpoint. As such, this book is frequently used in graduate-level coursework. It is also a timeless text, much in the same manner as Knuth's The Art of Computer Programming:

http://www.amazon.com/Art-Computer-P...5736409&sr=1-1
Thanks. I actually want both. I want the nitty-gritty meat and potatoes of algorithms and data structures, but I also want some examples of possible implementations in various languages (looking at C right now). I could probably get examples online. But, the books I was looking at are all language specific - of course, I wasn't looking at $100+ books. Those last two look impressive, but are far outside of my current book budget. I'll have to put them on my wish list. The book from O'Reilly's and even the Numerical Recipes are a little closer to what I can afford right now - or I can save up for a bit. Decisions, decisions.
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14)
Reply With Quote
  #8   (View Single Post)  
Old 4th November 2008
drl's Avatar
drl drl is offline
Port Guard
 
Join Date: May 2008
Posts: 18
Thanked 3 Times in 3 Posts
Default

Hi.

I see the items below on my bookshelf. I like the Sessions book because it was short enough to read quickly. Because these are old, you probably could get them from the used-book sources at Amazon.

I also listed the Icon book. Easily available and free, Icon has a number of facilities to help build structures. It handles most of the details, so that you can concentrate on the big picture; later you can dig into details of an implementation of an algorithm in a lower-level language.

Best wishes ... cheers, drl
Code:
Title: Data Structures and Program Design in C
Author: Robert L. Kruse, Bruce P. Leung, Clovis L. Tondo
Date: January 1991
Publisher: Prentice Hall
ISBN: 0137256493
Pages: 576
Categories: programming, design, software
Comments: 2.5 stars, 34 reviews (Amazon, 2008.11)

Title: Reliable Data Structures in C
Author: Thomas Plum
Date: 1985
Publisher: Plum Hall
ISBN: 091153704X
Pages: about 300
Categories: programming, design, software
Comments: 5 stars, 1 review (Amazon, 2008.11)

Title: Reusable Data Structures for C
Author: Roger Sessions
Date: January 1989
Publisher: Prentice Hall
ISBN: 0137790341
Pages: 166
Categories: programming, design, software
Comments: 0 reviews at Amazon

Title: The Icon Programming Language
Author: Ralph E. Griswold, Madge T. Griswold
Edition: Third
Date: June 24, 2000
Publisher: Coriolis Group Books
ISBN: 1573980013
Pages: 386
Categories: programming, text processing
Comments: 5 stars, 3 reviews (Amazon, 2008.11)
Reply With Quote
  #9   (View Single Post)  
Old 5th November 2008
anemos's Avatar
anemos anemos is offline
Fdisk Soldier
 
Join Date: May 2008
Location: Ελλάδα
Posts: 53
Thanked 5 Times in 5 Posts
Default

Have a look at http://www.dmst.aueb.gr/dds/ismr/data/index.htm.
I know it's not exactly what you're lookin for but... you can see some interesting book references.

Does anyone recognize the author?
Reply With Quote
Old 6th November 2008
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,193
Thanked 182 Times in 149 Posts
Default

Although I don't program in C, I own and can recommend "Algorithms in C" (paperback) by Robert Sedgewick. A new 2008 edition is about to be published.

Re: "Algorithms + Data Structures = Programs"

This is a book by Niklaus Wirth, the architect of Pascal and Modula. The code in the book is not pseudo code but Pascal. I bought this about 25 years ago because it had an example of balancing AVL trees.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Read Excel Data and store into Mysql Database using PHP cksraj Programming 2 3rd June 2009 12:09 PM
apache: data stuck in socket? goertzenator FreeBSD General 8 16th February 2009 04:01 PM
Mounting FreeBSD Data on Windows tuck Other OS 11 13th February 2009 10:19 AM
data recovery. LateNiteTV FreeBSD General 8 29th August 2008 08:11 PM
Apache data transfer limit cajunman4life General software and network 5 7th June 2008 05:13 PM


All times are GMT. The time now is 09:40 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick