The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
CIM implementations Godofredo UNIX and Linux Applications 0 03-25-2008 06:06 AM
Creating a Hash Table callmetheskull High Level Programming 4 12-23-2007 12:17 PM
MD5 hash filename bebar Shell Programming and Scripting 1 10-26-2007 10:44 AM
Creating a hash table using shell script jyotipg UNIX for Advanced & Expert Users 2 10-29-2003 02:37 AM
How can i load or insert a table in oracle from c language thru unix environment rramprasad High Level Programming 6 07-08-2002 09:17 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 12-11-2006
Registered User
 

Join Date: Dec 2006
Posts: 4
hash table implementations in C Language

Hello List,

Iam searching for a solution where i can use hash based searching .

In Detail , I have linked list which will be dynamically increasing .

I need a best searching mechanisim such a way that it can take only one itereation .

Right now iam using linear search which is taking n-1 iteriations if we have n nodes in it.

I cannot use binary search as i cannot arrange them in order because the node contains string variables.


Please advice me

regards
Kanth
Reply With Quote
Forum Sponsor
  #2  
Old 12-11-2006
Registered User
 

Join Date: Aug 2005
Location: Saskatchewan
Posts: 988
hashit is a good, generic hash table implimentation in C that supports open addressing, chaining, or blocking. It's under the GPLv2 licence.
Reply With Quote
  #3  
Old 12-11-2006
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,294
Why can you not sort string variables?


see:
http://sourceforge.net/projects/judy/

for libjudy which will create associative arrays - which is what you probably should consider.
Reply With Quote
  #4  
Old 12-11-2006
Moderator
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,475
glib is probably a more "standard" choice for hash table, especially if you are on Linux or BSD as you probably already has it installed.

http://www.gtk.org/api/2.6/glib/glib-Hash-Tables.html
Reply With Quote
  #5  
Old 12-12-2006
Registered User
 

Join Date: Dec 2006
Posts: 4
compiling the glib included programs in linux

thanks for your suggestions,

iam trying to use glib hashtables.

here my problem is i could not able to compile a program which has glib.h as the include one.


Code:
#include <stdio.h>
#include <glib.h>

int main(){

        printf ( "Hello");
        return 0;
}

gcc -I/usr/include/glib-2.0 -g glibtest.c -o glibtest.o

In file included from /usr/include/glib-2.0/glib/galloca.h:30,
from /usr/include/glib-2.0/glib.h:30,
from glibtest.c:2:
/usr/include/glib-2.0/glib/gtypes.h:30:24: glibconfig.h: No such file or directory
In file included from /usr/include/glib-2.0/glib/galloca.h:30,
from /usr/include/glib-2.0/glib.h:30,
from glibtest.c:2:


.
.
.
.
.
.


can any body advise my how to use glib

thanks
Reply With Quote
  #6  
Old 12-12-2006
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,693
glibconfig.h is in /usr/lib/glib-2.0/include

Code:
gcc -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -g glibtest.c -o glibtest.o
Reply With Quote
  #7  
Old 12-12-2006
Registered User
 

Join Date: Dec 2006
Posts: 4
thanks vino veritas it indeed worked
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
linux

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 12:12 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0