Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.lang.c > #397488

Re: A neat hash table implementation

From Michael S <already5chosen@yahoo.com>
Newsgroups comp.lang.c
Subject Re: A neat hash table implementation
Date 2026-04-11 20:28 +0300
Organization A noiseless patient Spider
Message-ID <20260411202835.000048d2@yahoo.com> (permalink)
References (2 earlier) <10ra4m9$s1bk$1@dont-email.me> <20260410132512.00005381@yahoo.com> <10rbdsm$18rg8$1@dont-email.me> <10rbq7m$130jl$1@dont-email.me> <10rcj13$1j0ae$1@dont-email.me>

Show all headers | View raw


On Fri, 10 Apr 2026 23:34:41 -0500
BGB <cr88192@gmail.com> wrote:

> On 4/10/2026 4:31 PM, James Kuyper wrote:
> > On 2026-04-10 14:00, BGB wrote:  
> >> On 4/10/2026 5:25 AM, Michael S wrote:  
> >>> On Fri, 10 Apr 2026 01:17:44 -0500
> >>> BGB <cr88192@gmail.com> wrote:  
> > ...  
> >>>> FWIW:
> >>>> Hash tables, like linked lists, are one of those things that
> >>>> pretty much everyone rolls custom nearly every time they need
> >>>> one. 
> >>>
> >>> Not that I disagree with many of your points below, but here you
> >>> are wrong. Hash tables are very *unlike* linked lists. Be sure
> >>> that overwhelming majority of professional programmers, including
> >>> good ones, never implemented a hash table themselves after they
> >>> left school.
> >>>
> >>> It seems, you mostly converse with people that share your extreme
> >>> DIY attitude. Please realize that for better or worse the bigger
> >>> world is different.
> >>>  
> >>
> >> ?...
> >>
> >> So, then are people just naively looping over arrays and using
> >> linear search for everything? Etc.  
> > 
> > How do you reach that conclusion from the above comment? All that
> > you can conclude from the above is that if they think they need a
> > hash table, they use one that someone else has already implemented,
> > rather than implementing one of their own. I personally have never
> > implemented a hash table, but I have used the hashing capability
> > that are built into several of the tools I do use. The closest I
> > have come to implementing my own hash table is to help someone else
> > fix the hash function they were passing to a hashing routine. Their
> > function was producing a ridiculously high number of collisions,
> > because they hadn't put any thought into the distribution of the
> > data they were hashing. 
> 
> There are few options sometimes.
> 
> 
> Say, for example, you want to look over a list of strings and map
> them to an ordinal number:
>    char *strings[]={
>    "first",
>    "second",
>    ...
>    NULL
>    };
> How do you do it then, exactly?...
> 
> 
> One could use a "for()" loop, say:
>    for(i=0; strings[i]; i++)
>      if(!strcmp(strings[i], str))
>        break;
> Which is, often OK.
> 
> 
> What else, use a 3rd party library? Far likely, that is a bigger
> pain... Well, and 3rd party library dependencies are often not worth
> it.
> 

And still, overwhelming majority of pro programmers will happily accept
the pain. That is, if the idea to use hash tables crossed their mind in
the first place.
Another option, probably more common in bigger organizations, is to
ask guru. Bigger organizations tend to employ gurus. Guru could ether
help them with 3rd party lib or, if in the good mood, implement
something that meets their needs.




Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

A neat hash table implementation highcrew <high.crew3868@fastmail.com> - 2026-04-07 23:38 +0200
  Re: A neat hash table implementation 🇵🇱Jacek Marcin Jaworski🇵🇱 <jmj@energokod.gda.pl> - 2026-04-08 05:14 +0200
    Re: A neat hash table implementation highcrew <high.crew3868@fastmail.com> - 2026-04-08 09:29 +0200
    Re: A neat hash table implementation BGB <cr88192@gmail.com> - 2026-04-10 01:17 -0500
      Re: A neat hash table implementation Michael S <already5chosen@yahoo.com> - 2026-04-10 13:25 +0300
        Re: A neat hash table implementation BGB <cr88192@gmail.com> - 2026-04-10 13:00 -0500
          Re: A neat hash table implementation James Kuyper <jameskuyper@alumni.caltech.edu> - 2026-04-10 17:31 -0400
            Re: A neat hash table implementation BGB <cr88192@gmail.com> - 2026-04-10 23:34 -0500
              Re: A neat hash table implementation Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2026-04-11 08:20 +0200
                Re: A neat hash table implementation BGB <cr88192@gmail.com> - 2026-04-11 04:19 -0500
              Re: A neat hash table implementation Michael S <already5chosen@yahoo.com> - 2026-04-11 20:28 +0300
          Re: A neat hash table implementation HashTables <invalid@invalid.invalid> - 2026-04-11 20:06 +0100
            Re: A neat hash table implementation Michael S <already5chosen@yahoo.com> - 2026-04-12 11:06 +0300
              Re: A neat hash table implementation BGB <cr88192@gmail.com> - 2026-04-12 04:24 -0500
              Re: A neat hash table implementation HashTables <invalid@invalid.invalid> - 2026-04-12 19:56 +0100
            Re: A neat hash table implementation Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-04-13 08:27 -0700
              Re: A neat hash table implementation BGB <cr88192@gmail.com> - 2026-04-13 14:46 -0500
                Re: A neat hash table implementation Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2026-04-14 01:14 +0200
              Re: A neat hash table implementation "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-04-13 14:42 -0700
                Re: A neat hash table implementation Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2026-04-14 01:17 +0200
          Re: A neat hash table implementation "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2026-04-11 14:19 -0700
            Re: A neat hash table implementation BGB <cr88192@gmail.com> - 2026-04-12 03:36 -0500
        Re: A neat hash table implementation Bart <bc@freeuk.com> - 2026-04-10 21:07 +0100
          Re: A neat hash table implementation BGB <cr88192@gmail.com> - 2026-04-10 16:13 -0500
        Re: A neat hash table implementation antispam@fricas.org (Waldek Hebisch) - 2026-04-12 14:51 +0000
  Re: A neat hash table implementation Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2026-04-08 10:42 +0200
    Re: A neat hash table implementation highcrew <high.crew3868@fastmail.com> - 2026-04-08 21:44 +0200
      Re: A neat hash table implementation makendo <makendo@makendo.invalid> - 2026-04-10 10:40 +0800
  Re: A neat hash table implementation Bonita Montero <Bonita.Montero@gmail.com> - 2026-04-10 05:42 +0200
    Re: A neat hash table implementation Michael S <already5chosen@yahoo.com> - 2026-04-10 13:13 +0300
      Re: A neat hash table implementation Bonita Montero <Bonita.Montero@gmail.com> - 2026-04-10 13:07 +0200

csiph-web