The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 09:06 AM
Creating a Hash Table callmetheskull High Level Programming 4 12-23-2007 03:17 PM
MD5 hash filename bebar Shell Programming and Scripting 1 10-26-2007 01:44 PM
Creating a hash table using shell script jyotipg UNIX for Advanced & Expert Users 2 10-29-2003 05:37 AM
How can i load or insert a table in oracle from c language thru unix environment rramprasad High Level Programming 6 07-09-2002 12:17 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-11-2006
vlrk vlrk is offline
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
  #2 (permalink)  
Old 12-11-2006
Corona688 Corona688 is offline
Registered User
  
 

Join Date: Aug 2005
Location: Saskatchewan
Posts: 1,933
hashit is a good, generic hash table implimentation in C that supports open addressing, chaining, or blocking. It's under the GPLv2 licence.
  #3 (permalink)  
Old 12-11-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,749
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.
  #4 (permalink)  
Old 12-11-2006
cbkihong cbkihong is offline Forum Advisor  
Advisor
  
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,624
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
  #5 (permalink)  
Old 12-12-2006
vlrk vlrk is offline
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
  #6 (permalink)  
Old 12-12-2006
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

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

Join Date: Dec 2006
Posts: 4
thanks vino veritas it indeed worked
Closed Thread

Bookmarks

Tags
linux

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:02 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0