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 05:06 AM
Creating a Hash Table callmetheskull High Level Programming 4 12-23-2007 11:17 AM
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 01: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
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-10-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 (permalink)  
Old 12-11-2006
Registered User
 

Join Date: Aug 2005
Location: Saskatchewan
Posts: 923
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 (permalink)  
Old 12-11-2006
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 3,419
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 (permalink)  
Old 12-11-2006
Moderator
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,418
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 (permalink)  
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 (permalink)  
Old 12-12-2006
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,636
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 (permalink)  
Old 12-12-2006
Registered User
 

Join Date: Dec 2006
Posts: 4
thanks vino veritas it indeed worked
Reply With Quote
Google UNIX.COM
Reply

Tags
linux

Thread Tools
Display Modes




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


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

Content Relevant URLs by vBSEO 3.2.0