Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #83511 > unrolled thread

Testing nodes and lists for hashtable

Started byAlla _ <modelling.data@gmail.com>
First post2016-03-09 00:52 -0800
Last post2016-03-30 07:00 -0700
Articles 20 on this page of 330 — 24 participants

Back to article view | Back to comp.lang.c


Contents

  Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-09 00:52 -0800
    Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-09 10:13 +0000
      Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-09 02:19 -0800
        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-09 02:23 -0800
        Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-09 13:00 +0000
    Re: Testing nodes and lists for hashtable Barry Schwarz <schwarzb@dqel.com> - 2016-03-09 02:38 -0800
      Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-09 02:59 -0800
        Re: Testing nodes and lists for hashtable Barry Schwarz <schwarzb@dqel.com> - 2016-03-09 10:35 -0800
          Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-10 00:20 -0800
    Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-09 02:56 -0800
      Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-09 13:11 +0000
        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-09 06:37 -0800
          Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-09 15:50 +0000
            Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-09 08:19 -0800
              Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-09 17:18 +0000
                Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-10 00:11 -0800
                  Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-10 08:48 +0000
                    Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-10 04:17 -0800
                  Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-10 11:12 +0000
                    Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-10 04:16 -0800
                    Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-10 04:20 -0800
            Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-09 08:41 -0800
              Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-09 17:27 +0000
                Re: Testing nodes and lists for hashtable Stephen Sprunk <stephen@sprunk.org> - 2016-03-09 22:41 -0600
                  Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-10 10:38 +0000
                    Re: Testing nodes and lists for hashtable Stephen Sprunk <stephen@sprunk.org> - 2016-03-10 09:37 -0600
                      Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-10 15:51 +0000
                        Re: Testing nodes and lists for hashtable Stephen Sprunk <stephen@sprunk.org> - 2016-03-10 18:42 -0600
                        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-11 04:17 -0800
                Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-10 00:18 -0800
                  Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-10 08:51 +0000
            Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-09 08:50 -0800
    Re: Testing nodes and lists for hashtable jadill33@gmail.com - 2016-03-09 07:16 -0800
    Re: Testing nodes and lists for hashtable Stephen Sprunk <stephen@sprunk.org> - 2016-03-09 09:27 -0600
      Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-09 07:46 -0800
        Re: Testing nodes and lists for hashtable Barry Schwarz <schwarzb@dqel.com> - 2016-03-09 10:56 -0800
          Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-10 00:25 -0800
            Re: Testing nodes and lists for hashtable Barry Schwarz <schwarzb@dqel.com> - 2016-03-10 08:55 -0800
    Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-11 01:14 -0800
      Re: Testing nodes and lists for hashtable Barry Schwarz <schwarzb@dqel.com> - 2016-03-11 01:53 -0800
        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-11 02:25 -0800
          Re: Testing nodes and lists for hashtable Barry Schwarz <schwarzb@dqel.com> - 2016-03-11 12:31 -0800
            Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-12 00:03 -0800
              Re: Testing nodes and lists for hashtable Barry Schwarz <schwarzb@dqel.com> - 2016-03-12 09:04 -0800
        Re: Testing nodes and lists for hashtable mark.bluemel@gmail.com - 2016-03-11 02:30 -0800
          Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-11 02:39 -0800
            Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-11 02:52 -0800
              Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-11 04:09 -0800
              Re: Testing nodes and lists for hashtable mark.bluemel@gmail.com - 2016-03-14 08:41 -0700
        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-11 02:34 -0800
        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-11 02:41 -0800
          Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-11 12:14 +0000
            Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-11 04:20 -0800
              Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-11 12:33 +0000
              Re: Testing nodes and lists for hashtable Randy Howard <rhoward.mx@EverybodyUsesIt.com> - 2016-03-11 12:12 -0600
                Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-11 10:24 -0800
                Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-11 19:04 +0000
                  Re: Testing nodes and lists for hashtable Randy Howard <rhoward.mx@EverybodyUsesIt.com> - 2016-03-11 14:20 -0600
                  Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-11 23:55 -0800
            Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-11 04:23 -0800
            Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-11 04:25 -0800
              Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-11 12:36 +0000
                Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-11 05:56 -0800
                  Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-11 14:55 +0000
                    Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-11 07:22 -0800
                    Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-11 07:29 -0800
                      Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-11 16:01 +0000
                        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-11 23:41 -0800
                          Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-13 13:48 +0000
                    Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-11 20:20 +0000
                      Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-13 13:06 +0000
                  Re: Testing nodes and lists for hashtable Stephen Sprunk <stephen@sprunk.org> - 2016-03-12 17:41 -0600
                    Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-13 05:03 -0700
                      Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-13 13:50 +0000
                        Re: Testing nodes and lists for hashtable Stephen Sprunk <stephen@sprunk.org> - 2016-03-13 10:32 -0500
                          Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-13 09:18 -0700
                          Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-13 16:31 +0000
                            Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-13 10:17 -0700
                      Re: Testing nodes and lists for hashtable Stephen Sprunk <stephen@sprunk.org> - 2016-03-13 10:17 -0500
                    Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-13 09:06 -0700
                      Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-13 09:51 -0700
                        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-13 10:31 -0700
                      Re: Testing nodes and lists for hashtable Stephen Sprunk <stephen@sprunk.org> - 2016-03-13 12:41 -0500
      Re: Testing nodes and lists for hashtable Keith Thompson <kst-u@mib.org> - 2016-03-11 08:41 -0800
        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-11 23:54 -0800
    Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-12 08:10 -0800
      Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-12 08:17 -0800
        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-12 08:19 -0800
          Re: Testing nodes and lists for hashtable Barry Schwarz <schwarzb@dqel.com> - 2016-03-12 09:16 -0800
            Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-13 04:17 -0700
          Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-12 19:37 +0000
            Re: Testing nodes and lists for hashtable Stephen Sprunk <stephen@sprunk.org> - 2016-03-13 11:20 -0500
              Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-13 21:37 +0000
        Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-12 09:48 -0800
          Re: Testing nodes and lists for hashtable raltbos@xs4all.nl (Richard Bos) - 2016-03-12 20:31 +0000
          Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-12 21:18 +0000
          Re: Testing nodes and lists for hashtable Stephen Sprunk <stephen@sprunk.org> - 2016-03-12 17:54 -0600
          Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-13 04:25 -0700
            Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-13 04:44 -0700
              Re: Testing nodes and lists for hashtable Stephen Sprunk <stephen@sprunk.org> - 2016-03-13 12:31 -0500
                Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-13 11:14 -0700
                  Re: Testing nodes and lists for hashtable Stephen Sprunk <stephen@sprunk.org> - 2016-03-13 16:17 -0500
                    Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-13 14:37 -0700
    Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-13 11:43 -0700
      Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-13 12:08 -0700
      Re: Testing nodes and lists for hashtable Stephen Sprunk <stephen@sprunk.org> - 2016-03-13 16:31 -0500
        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-14 01:12 -0700
        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-14 01:21 -0700
          Re: Testing nodes and lists for hashtable Stephen Sprunk <stephen@sprunk.org> - 2016-03-14 13:48 -0500
            Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-15 01:43 -0700
        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-14 01:35 -0700
          Re: Testing nodes and lists for hashtable Stephen Sprunk <stephen@sprunk.org> - 2016-03-14 13:44 -0500
            Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-15 01:39 -0700
      Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-13 23:04 +0000
        Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-13 16:09 -0700
          Re: Testing nodes and lists for hashtable Keith Thompson <kst-u@mib.org> - 2016-03-13 17:54 -0700
        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-14 01:58 -0700
          Re: Testing nodes and lists for hashtable fir <profesor.fir@gmail.com> - 2016-03-14 03:08 -0700
          Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-14 10:59 +0000
            Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-14 04:59 -0700
              Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-14 13:15 +0000
            Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-14 11:09 -0700
        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-14 03:18 -0700
          Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-14 11:03 +0000
            Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-14 11:17 -0700
              Re: Testing nodes and lists for hashtable Barry Schwarz <schwarzb@dqel.com> - 2016-03-14 15:16 -0700
                Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-15 01:59 -0700
                  Re: Testing nodes and lists for hashtable Barry Schwarz <schwarz45@yahoo.com> - 2016-03-15 20:13 -0700
                    Re: Testing nodes and lists for hashtable supercat@casperkitty.com - 2016-03-15 22:09 -0700
                    Re: Testing nodes and lists for hashtable BartC <bc@freeuk.com> - 2016-03-16 11:53 +0000
                    Re: Testing nodes and lists for hashtable Stephen Sprunk <stephen@sprunk.org> - 2016-03-16 09:39 -0500
                      Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-16 07:57 -0700
                        Re: Testing nodes and lists for hashtable supercat@casperkitty.com - 2016-03-16 08:38 -0700
                          Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-16 09:04 -0700
                            Re: Testing nodes and lists for hashtable Stephen Sprunk <stephen@sprunk.org> - 2016-03-16 11:22 -0500
                            Re: Testing nodes and lists for hashtable Keith Thompson <kst-u@mib.org> - 2016-03-16 10:42 -0700
                              Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-16 10:57 -0700
                                Re: Testing nodes and lists for hashtable Keith Thompson <kst-u@mib.org> - 2016-03-16 11:57 -0700
                        Re: Testing nodes and lists for hashtable Stephen Sprunk <stephen@sprunk.org> - 2016-03-16 10:43 -0500
                      Re: Testing nodes and lists for hashtable Barry Schwarz <schwarzb@dqel.com> - 2016-03-16 10:59 -0700
                        Re: Testing nodes and lists for hashtable Stephen Sprunk <stephen@sprunk.org> - 2016-03-16 13:22 -0500
                          Re: Testing nodes and lists for hashtable Barry Schwarz <schwarzb@dqel.com> - 2016-03-16 16:09 -0700
                            Re: Testing nodes and lists for hashtable supercat@casperkitty.com - 2016-03-16 17:03 -0700
                            Re: Testing nodes and lists for hashtable raltbos@xs4all.nl (Richard Bos) - 2016-03-20 13:04 +0000
                            Re: Testing nodes and lists for hashtable Tim Rentsch <txr@alumni.caltech.edu> - 2016-03-30 09:07 -0700
                              Re: Testing nodes and lists for hashtable luser droog <luser.droog@gmail.com> - 2016-03-31 20:34 -0700
          Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-14 14:04 +0000
          Re: Testing nodes and lists for hashtable Barry Schwarz <schwarzb@dqel.com> - 2016-03-14 11:07 -0700
    Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-14 03:49 -0700
      Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-14 13:03 +0000
        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-14 11:24 -0700
        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-14 11:41 -0700
          Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-14 19:35 +0000
            Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-15 01:53 -0700
              Re: Testing nodes and lists for hashtable luser droog <luser.droog@gmail.com> - 2016-03-15 02:03 -0700
                Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-15 02:09 -0700
                  Re: Testing nodes and lists for hashtable luser droog <luser.droog@gmail.com> - 2016-03-15 02:13 -0700
                    Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-15 02:22 -0700
                  Re: Testing nodes and lists for hashtable luser droog <luser.droog@gmail.com> - 2016-03-15 02:15 -0700
                    Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-15 02:28 -0700
                    Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-15 02:30 -0700
              Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-15 09:13 +0000
                Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-15 02:28 -0700
                Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-15 03:15 -0700
                  Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-15 13:26 +0000
                  Re: Testing nodes and lists for hashtable Keith Thompson <kst-u@mib.org> - 2016-03-15 09:18 -0700
                Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-15 03:19 -0700
                  Re: Testing nodes and lists for hashtable David Brown <david.brown@hesbynett.no> - 2016-03-15 15:21 +0100
                    Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-15 08:39 -0700
                      Re: Testing nodes and lists for hashtable Keith Thompson <kst-u@mib.org> - 2016-03-15 09:26 -0700
                        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-16 00:10 -0700
                  Re: Testing nodes and lists for hashtable Keith Thompson <kst-u@mib.org> - 2016-03-15 09:19 -0700
                    Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-16 00:08 -0700
                      Re: Testing nodes and lists for hashtable David Brown <david.brown@hesbynett.no> - 2016-03-16 08:55 +0100
                      Re: Testing nodes and lists for hashtable Keith Thompson <kst-u@mib.org> - 2016-03-16 09:17 -0700
                        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-16 09:25 -0700
          Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-14 13:06 -0700
            Re: Testing nodes and lists for hashtable Gareth Owen <gwowen@gmail.com> - 2016-03-14 20:29 +0000
            Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-14 21:03 +0000
              Re: Testing nodes and lists for hashtable Keith Thompson <kst-u@mib.org> - 2016-03-14 14:57 -0700
                Re: Testing nodes and lists for hashtable raltbos@xs4all.nl (Richard Bos) - 2016-03-14 22:35 +0000
              Re: Testing nodes and lists for hashtable David Brown <david.brown@hesbynett.no> - 2016-03-16 19:47 +0100
            Re: Testing nodes and lists for hashtable Keith Thompson <kst-u@mib.org> - 2016-03-14 14:26 -0700
      Re: Testing nodes and lists for hashtable Barry Schwarz <schwarzb@dqel.com> - 2016-03-14 11:37 -0700
      Re: Testing nodes and lists for hashtable Barry Schwarz <schwarzb@dqel.com> - 2016-03-14 11:37 -0700
    Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-15 08:58 -0700
      Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-15 16:12 +0000
        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-16 00:04 -0700
      Re: Testing nodes and lists for hashtable Barry Schwarz <schwarzb@dqel.com> - 2016-03-15 10:48 -0700
        Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-15 18:00 +0000
          Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-15 19:20 +0000
            Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-15 21:24 +0000
            Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-16 00:50 -0700
              Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-16 11:19 +0000
                Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-16 04:37 -0700
                  Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-16 11:51 +0000
                    Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-16 05:20 -0700
                      Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-16 07:13 -0700
                        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-16 09:05 -0700
                Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-16 11:45 +0000
                  Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-16 13:46 +0000
                    Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-16 14:00 +0000
                    Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-16 07:05 -0700
                      Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-16 16:42 +0000
                        Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-16 10:21 -0700
                          Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-16 17:33 +0000
                            Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-16 10:44 -0700
                              Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-16 18:00 +0000
                                Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-16 11:08 -0700
                                  Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-16 18:19 +0000
                                    Re: Testing nodes and lists for hashtable Gareth Owen <gwowen@gmail.com> - 2016-03-16 19:38 +0000
                                      Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-16 14:00 -0700
                                      Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-16 21:52 +0000
                                        Re: Testing nodes and lists for hashtable Gareth Owen <gwowen@gmail.com> - 2016-03-16 22:12 +0000
                                Re: Testing nodes and lists for hashtable Stephen Sprunk <stephen@sprunk.org> - 2016-03-16 13:39 -0500
                          Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-16 15:39 -0700
                            Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-17 02:59 +0000
                              Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-17 04:20 -0700
                                Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-17 23:46 +0000
                                  Re: Testing nodes and lists for hashtable Jerry Stuckle <jstucklex@attglobal.net> - 2016-03-17 20:04 -0400
                                    Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-18 01:05 +0000
                                      Re: Testing nodes and lists for hashtable Jerry Stuckle <jstucklex@attglobal.net> - 2016-03-17 22:35 -0400
                                  Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-17 17:19 -0700
                                    Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-18 01:39 +0000
                                      Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-18 02:54 -0700
                                        Re: Testing nodes and lists for hashtable Stephen Sprunk <stephen@sprunk.org> - 2016-03-18 09:08 -0500
                                          Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-18 11:20 -0700
                                        Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-18 21:29 +0000
                                          Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-18 17:48 -0700
                            Re: Testing nodes and lists for hashtable Stephen Sprunk <stephen@sprunk.org> - 2016-03-16 22:09 -0500
                              Re: Testing nodes and lists for hashtable raltbos@xs4all.nl (Richard Bos) - 2016-03-17 11:49 +0000
                                Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-17 08:45 -0700
                                Re: Testing nodes and lists for hashtable Stephen Sprunk <stephen@sprunk.org> - 2016-03-17 12:11 -0500
                                  Re: Testing nodes and lists for hashtable supercat@casperkitty.com - 2016-03-17 10:31 -0700
                                    Re: Testing nodes and lists for hashtable Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-03-17 11:09 -0700
                                      Re: Testing nodes and lists for hashtable Stephen Sprunk <stephen@sprunk.org> - 2016-03-17 16:15 -0500
                                      Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-18 00:39 +0000
                      Re: Testing nodes and lists for hashtable Stephen Sprunk <stephen@sprunk.org> - 2016-03-16 12:04 -0500
                    Re: Testing nodes and lists for hashtable Steve Thompson <stevet810@gmail.com> - 2016-03-17 14:21 +0000
            Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-16 00:53 -0700
            Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-16 01:00 -0700
            Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-16 01:24 -0700
              Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-16 11:08 +0000
                Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-16 11:25 +0000
          Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-16 00:41 -0700
            Re: Testing nodes and lists for hashtable Stephen Sprunk <stephen@sprunk.org> - 2016-03-16 08:27 -0500
    Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-16 06:43 -0700
      Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-16 14:07 +0000
        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-16 08:16 -0700
          Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-16 15:25 +0000
            Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-16 08:30 -0700
      Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-16 20:32 +0000
        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-17 03:26 -0700
          Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-17 16:15 +0000
            Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-17 11:07 -0700
    Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-16 08:47 -0700
      Re: Testing nodes and lists for hashtable Stephen Sprunk <stephen@sprunk.org> - 2016-03-16 10:54 -0500
        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-16 09:35 -0700
      Re: Testing nodes and lists for hashtable Barry Schwarz <schwarzb@dqel.com> - 2016-03-16 11:31 -0700
        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-17 02:53 -0700
          Re: Testing nodes and lists for hashtable Barry Schwarz <schwarzb@dqel.com> - 2016-03-28 18:08 -0700
            Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-30 02:07 -0700
              Re: Testing nodes and lists for hashtable Barry Schwarz <schwarzb@dqel.com> - 2016-03-30 09:45 -0700
                Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-30 17:54 +0100
      Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-16 20:26 +0000
        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-17 03:00 -0700
          Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-17 16:05 +0000
    Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-16 09:10 -0700
      Re: Testing nodes and lists for hashtable Barry Schwarz <schwarzb@dqel.com> - 2016-03-16 12:24 -0700
        Re: Testing nodes and lists for hashtable Keith Thompson <kst-u@mib.org> - 2016-03-16 13:16 -0700
          Re: Testing nodes and lists for hashtable Barry Schwarz <schwarzb@dqel.com> - 2016-03-16 16:20 -0700
            Re: Testing nodes and lists for hashtable supercat@casperkitty.com - 2016-03-16 16:54 -0700
            Re: Testing nodes and lists for hashtable Keith Thompson <kst-u@mib.org> - 2016-03-16 17:27 -0700
        Re: Testing nodes and lists for hashtable supercat@casperkitty.com - 2016-03-16 13:18 -0700
      Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-16 20:21 +0000
        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-17 04:23 -0700
    Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-17 04:47 -0700
      Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-17 05:40 -0700
        Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-17 12:49 +0000
          Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-17 06:45 -0700
        Re: Testing nodes and lists for hashtable mark.bluemel@gmail.com - 2016-03-17 10:00 -0700
          Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-17 12:40 -0700
    Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-28 12:00 -0700
      Re: Testing nodes and lists for hashtable Keith Thompson <kst-u@mib.org> - 2016-03-28 12:37 -0700
        Re: Testing nodes and lists for hashtable Geoff <geoff@invalid.invalid> - 2016-03-28 17:43 -0700
        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-30 01:31 -0700
        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-30 01:55 -0700
          Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-30 10:23 +0100
            Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-30 02:32 -0700
            Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-30 02:33 -0700
          Re: Testing nodes and lists for hashtable Geoff <geoff@invalid.invalid> - 2016-03-30 07:04 -0700
            Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-30 15:17 +0100
              Re: Testing nodes and lists for hashtable Geoff <geoff@invalid.invalid> - 2016-03-30 07:46 -0700
                Re: Testing nodes and lists for hashtable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-30 16:41 +0100
                  Re: Testing nodes and lists for hashtable Geoff <geoff@invalid.invalid> - 2016-03-30 09:16 -0700
                    Re: Testing nodes and lists for hashtable Geoff <geoff@invalid.invalid> - 2016-03-30 09:18 -0700
                    Re: Testing nodes and lists for hashtable Geoff <geoff@invalid.invalid> - 2016-03-30 09:37 -0700
          Re: Testing nodes and lists for hashtable Barry Schwarz <schwarzb@dqel.com> - 2016-03-30 10:32 -0700
            Re: Testing nodes and lists for hashtable Keith Thompson <kst-u@mib.org> - 2016-03-30 12:10 -0700
      Re: Testing nodes and lists for hashtable Geoff <geoff@invalid.invalid> - 2016-03-28 17:42 -0700
        Re: Testing nodes and lists for hashtable Keith Thompson <kst-u@mib.org> - 2016-03-29 08:51 -0700
          Re: Testing nodes and lists for hashtable Geoff <geoff@invalid.invalid> - 2016-03-29 09:56 -0700
            Re: Testing nodes and lists for hashtable Keith Thompson <kst-u@mib.org> - 2016-03-29 12:09 -0700
              Re: Testing nodes and lists for hashtable Geoff <geoff@invalid.invalid> - 2016-03-29 16:34 -0700
                Re: Testing nodes and lists for hashtable Keith Thompson <kst-u@mib.org> - 2016-03-29 16:50 -0700
                  Re: Testing nodes and lists for hashtable Geoff <geoff@invalid.invalid> - 2016-03-29 17:17 -0700
                  Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-30 02:30 -0700
                Re: Testing nodes and lists for hashtable Richard Heathfield <rjh@cpax.org.uk> - 2016-03-30 00:52 +0100
                  Re: Testing nodes and lists for hashtable Geoff <geoff@invalid.invalid> - 2016-03-29 17:27 -0700
                Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-30 02:26 -0700
                  Re: Testing nodes and lists for hashtable mark.bluemel@gmail.com - 2016-03-30 07:09 -0700
                  Re: Testing nodes and lists for hashtable Geoff <geoff@invalid.invalid> - 2016-03-30 07:33 -0700
                    Re: Testing nodes and lists for hashtable Jerry Stuckle <jstucklex@attglobal.net> - 2016-03-30 11:32 -0400
                      Re: Testing nodes and lists for hashtable mrs@kithrup.com (Mike Stump) - 2016-04-29 08:21 +0000
                        Re: Testing nodes and lists for hashtable Jerry Stuckle <jstucklex@attglobal.net> - 2016-04-29 10:35 -0400
                          Re: Testing nodes and lists for hashtable Ken Brody <kenbrody@spamcop.net> - 2016-04-29 11:29 -0400
                            Re: Testing nodes and lists for hashtable Jerry Stuckle <jstucklex@attglobal.net> - 2016-04-29 12:21 -0400
                              Re: Testing nodes and lists for hashtable Ken Brody <kenbrody@spamcop.net> - 2016-05-02 11:55 -0400
                                Re: Testing nodes and lists for hashtable Jerry Stuckle <jstucklex@attglobal.net> - 2016-05-02 13:13 -0400
                  Re: Testing nodes and lists for hashtable supercat@casperkitty.com - 2016-03-30 08:15 -0700
                    Re: Testing nodes and lists for hashtable Jerry Stuckle <jstucklex@attglobal.net> - 2016-03-30 11:39 -0400
                      Re: Testing nodes and lists for hashtable supercat@casperkitty.com - 2016-03-30 09:47 -0700
                  Re: Testing nodes and lists for hashtable Geoff <geoff@invalid.invalid> - 2016-03-30 08:48 -0700
            Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-30 02:18 -0700
              Re: Testing nodes and lists for hashtable Geoff <geoff@invalid.invalid> - 2016-03-30 06:56 -0700
                Re: Testing nodes and lists for hashtable Keith Thompson <kst-u@mib.org> - 2016-03-30 09:04 -0700
                  Re: Testing nodes and lists for hashtable Geoff <geoff@invalid.invalid> - 2016-03-30 09:25 -0700
                Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-04-01 00:52 -0700
        Re: Testing nodes and lists for hashtable Alla _ <modelling.data@gmail.com> - 2016-03-30 02:05 -0700
          Re: Testing nodes and lists for hashtable Geoff <geoff@invalid.invalid> - 2016-03-30 07:00 -0700

Page 5 of 17 — ← Prev page 1 … 3 4 [5] 6 7 … 17  Next page →


#83790

FromMalcolm McLean <malcolm.mclean5@btinternet.com>
Date2016-03-13 09:51 -0700
Message-ID<f1376778-e586-4751-94c8-f7c277dce2a2@googlegroups.com>
In reply to#83782
On Sunday, March 13, 2016 at 4:06:20 PM UTC, Alla _ wrote:
>
> I am not sure I understand how the above statement works,
> if create_table() function has a void return type, i.e.
> it doesn't have any return value.
> 
create_table must have the signature

void create_table(void)

and must create the hashtable.

If you write a function

HT *hashtable_create( /* parameters like capacity, element size, etc*/ )
{
   HT *res;
  int i;

   res = malloc(sizeof(HT));
   if(!res)
      goto error;
   // for the sake of argument this table has 26 "slots"
   res->table = malloc(26 * sizeof(node *));
   if(!res->table)
      goto error;
   // set the slots to NULL
   for(i=0;i<26;i++)
      res->table[i] = NULL;
  // all the rest of the set-up code here
   return res;
error:
   // as an advanced exercise, prevent memory leaks by destroying a
   // partly-constructed table here
    return 0;
}

The we can wrote create_table() like this

HT * hashtable; // our global
void create_table(void)
{
   hashtable = hashtable_create( /* pass any arguments here, e.g. table capacity */ );
   if(!hashtable)
   {
       printf("out of memory \n");
       exit(EXIT_FAILURE);
   }
}

[toc] | [prev] | [next] | [standalone]


#83793

FromAlla _ <modelling.data@gmail.com>
Date2016-03-13 10:31 -0700
Message-ID<2bb7f6bd-ccfa-41de-a38a-8dc6dea0f03c@googlegroups.com>
In reply to#83790
On Sunday, March 13, 2016 at 8:51:26 PM UTC+4, Malcolm McLean wrote:
> On Sunday, March 13, 2016 at 4:06:20 PM UTC, Alla _ wrote:
> >
> > I am not sure I understand how the above statement works,
> > if create_table() function has a void return type, i.e.
> > it doesn't have any return value.
> > 
> create_table must have the signature
> 
I was referring to a specific code that Stephen has written;
that one won't compile, and as I understand if the function
has a void return type, I can't assign its "value" to some
variable, like hashtable = create_table(). I am asking to 
clarify that piece, because most likely I have missed something.
> void create_table(void)
> 
> and must create the hashtable.
> 
> If you write a function
> 
> HT *hashtable_create( /* parameters like capacity, element size, etc*/ )
> {
>    HT *res;
>   int i;
> 
>    res = malloc(sizeof(HT));
>    if(!res)
>       goto error;
>    // for the sake of argument this table has 26 "slots"
>    res->table = malloc(26 * sizeof(node *));
>    if(!res->table)
>       goto error;
>    // set the slots to NULL
>    for(i=0;i<26;i++)
>       res->table[i] = NULL;
>   // all the rest of the set-up code here
>    return res;
> error:
>    // as an advanced exercise, prevent memory leaks by destroying a
>    // partly-constructed table here
>     return 0;
> }
> 
> The we can wrote create_table() like this
> 
> HT * hashtable; // our global
> void create_table(void)
> {
>    hashtable = hashtable_create( /* pass any arguments here, e.g. table capacity */ );
>    if(!hashtable)
>    {
>        printf("out of memory \n");
>        exit(EXIT_FAILURE);
>    }
> }

[toc] | [prev] | [next] | [standalone]


#83796

FromStephen Sprunk <stephen@sprunk.org>
Date2016-03-13 12:41 -0500
Message-ID<nc48ic$im7$1@dont-email.me>
In reply to#83782
On 13-Mar-16 11:06, Alla _ wrote:
> On Sunday, March 13, 2016 at 3:42:01 AM UTC+4, Stephen Sprunk wrote:
>> void insert_node(node *new_node)
>> {
>>     if (!new_node)
>>         return;  /* or handle as error */
>>
>>     if (!hashtable)
>>         if (!(hashtable = create_table()))
> 
> I am not sure I understand how the above statement works,
> if create_table() function has a void return type, i.e.
> it doesn't have any return value.

Ah, yes; that's the kind of thing that happens when a design changes
partway through implementation :/

The above should be:

    if (!hashtable)
        create_table(); /* handles its own errors */

I started with a version of create_table() that did return the table it
created (or NULL), which is IMHO the correct way, but that didn't fit
you being forced to use globals, and I forgot to revise the caller.

>> void create_table()
>> {
>> ...
>> }

S

-- 
Stephen Sprunk         "God does not play dice."  --Albert Einstein
CCIE #3723         "God is an inveterate gambler, and He throws the
K5SSS        dice at every possible opportunity." --Stephen Hawking

[toc] | [prev] | [next] | [standalone]


#83718

FromKeith Thompson <kst-u@mib.org>
Date2016-03-11 08:41 -0800
Message-ID<lnegbhm0gy.fsf@kst-u.example.com>
In reply to#83695
Alla _ <modelling.data@gmail.com> writes:
[...]
> For now, to keep it simple until I am done with the table issues,
> I use the most simple hash function that has no algorithm; it simply
> uses a first letter as a hash value (later I will need to sort nodes
> within buckets).
[...]

Using the first letter *is* an algorithm; it's just a very simple one.

Once you get your hash table code working, you might consider testing it
with a hash function that always returns the same value, so all nodes go
into the same bucket.  That's obviously not a good function for real
use, but it's an edge case that your hash table code should be able to
handle correctly (if slowly).  Don't worry about that yet, but keep it
in the back of your mind.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

[toc] | [prev] | [next] | [standalone]


#83729

FromAlla _ <modelling.data@gmail.com>
Date2016-03-11 23:54 -0800
Message-ID<56c52952-079f-4281-94e8-2a7fffbe9655@googlegroups.com>
In reply to#83718
On Friday, March 11, 2016 at 8:41:11 PM UTC+4, Keith Thompson wrote:
> Alla _ <modelling.data@gmail.com> writes:
> [...]
> > For now, to keep it simple until I am done with the table issues,
> > I use the most simple hash function that has no algorithm; it simply
> > uses a first letter as a hash value (later I will need to sort nodes
> > within buckets).
> [...]
> 
> Using the first letter *is* an algorithm; it's just a very simple one.
> 
> Once you get your hash table code working, you might consider testing it
> with a hash function that always returns the same value, so all nodes go
> into the same bucket.  That's obviously not a good function for real
> use, but it's an edge case that your hash table code should be able to
> handle correctly (if slowly).  Don't worry about that yet, but keep it
> in the back of your mind.
Thank you! I will do that.

[toc] | [prev] | [next] | [standalone]


#83743

FromAlla _ <modelling.data@gmail.com>
Date2016-03-12 08:10 -0800
Message-ID<4d2530a9-0c78-47c6-aacd-5a1c79788e46@googlegroups.com>
In reply to#83511
I am still doing my best to understand how to form 
a table by attaching subsequent nodes (not putting 
a node at the beginning), but also looking into adding
another function that should check if the word from 
any given text is actually in the dictionary; for now
I use the load function that attaches nodes at the 
beginning, because it's the only working version I
have for the moment.
My question the load () actually returns a boolean
value, so it's not 
void load(const char *dictionary), as I had it, 
but bool load(const char *dictionary)

I have realized that I am not sure whether, after I have 
filled the hashtable with words by calling the load()
function, the table is available for all other functions,
because all operations inside load are done with 
pointers to hashtable structure, or it's not available.
I am not allowed to change function's declarations,
and bool check(const char* text_word) can't take any
other arguments; so to access hashtable values I can't 
call load again within check function. 

bool load(const char *dictionary)
{
    FILE *open_dict;
    node *new_node = NULL;
    ht *hashtable = NULL;
    char new_word[LENGTH] = {0};
    
    if ((open_dict = fopen(dictionary, "r")) != NULL)
    {
        if ((hashtable = create_table()) != NULL)
        {
            while (fscanf(open_dict, "%44s", new_word) == 1 &&
                   (new_node = create_node(new_word)) != NULL)
            {       
                  unsigned int hash_index = hash(new_word) % LISTS;
                    
                  if (empty_list(hashtable, hash_index))
                      hashtable->list[hash_index] = new_node;
                  else
                  {
                      new_node->next = hashtable->list[hash_index];
                      hashtable->list[hash_index] = new_node;
                  }
            
            }
            // free(hashtable); // return hashtable; (for later usage)
            return true;
        }
        else
        {
            printf("Couldn't create a table: out of memory\n");
            return false;
        }
        fclose(open_dict);
    }
    
    printf("Couldn't open dictionary\n");
    return false;
}

 Thank you!

[toc] | [prev] | [next] | [standalone]


#83744

FromAlla _ <modelling.data@gmail.com>
Date2016-03-12 08:17 -0800
Message-ID<18a166c1-d354-4bca-901b-8015586ef5cd@googlegroups.com>
In reply to#83743
On Saturday, March 12, 2016 at 8:10:58 PM UTC+4, Alla _ wrote:
> I am still doing my best to understand how to form 
> a table by attaching subsequent nodes (not putting 
> a node at the beginning), but also looking into adding
> another function that should check if the word from 
> any given text is actually in the dictionary; for now
> I use the load function that attaches nodes at the 
> beginning, because it's the only working version I
> have for the moment.
> My question the load () actually returns a boolean
> value, so it's not 
> void load(const char *dictionary), as I had it, 
> but bool load(const char *dictionary)
> 
> I have realized that I am not sure whether, after I have 
> filled the hashtable with words by calling the load()
> function, the table is available for all other functions,
> because all operations inside load are done with 
> pointers to hashtable structure, or it's not available.
> I am not allowed to change function's declarations,
> and bool check(const char* text_word) can't take any
> other arguments; so to access hashtable values I can't 
> call load again within check function. 
> 
> bool load(const char *dictionary)
> {
>     FILE *open_dict;
>     node *new_node = NULL;
>     ht *hashtable = NULL;
>     char new_word[LENGTH] = {0};
>     
>     if ((open_dict = fopen(dictionary, "r")) != NULL)
>     {
>         if ((hashtable = create_table()) != NULL)
>         {
>             while (fscanf(open_dict, "%44s", new_word) == 1 &&
>                    (new_node = create_node(new_word)) != NULL)
>             {       
>                   unsigned int hash_index = hash(new_word) % LISTS;
>                     
>                   if (empty_list(hashtable, hash_index))
>                       hashtable->list[hash_index] = new_node;
>                   else
>                   {
>                       new_node->next = hashtable->list[hash_index];
>                       hashtable->list[hash_index] = new_node;
>                   }
>             
>             }
>             // free(hashtable); // return hashtable; (for later usage)
>             return true;
>         }
>         else
>         {
>             printf("Couldn't create a table: out of memory\n");
>             return false;
>         }
>         fclose(open_dict);
>     }
>     
>     printf("Couldn't open dictionary\n");
>     return false;
> }
> 
>  Thank you!

Interesting: I definately can't access hashtable, because I never
return it from the load function. Truly interesting. I'll be back
on this - hope to come up with a good solution. 

[toc] | [prev] | [next] | [standalone]


#83745

FromAlla _ <modelling.data@gmail.com>
Date2016-03-12 08:19 -0800
Message-ID<3b9d1b88-ef25-42b1-990a-fc11a8ede71d@googlegroups.com>
In reply to#83744
On Saturday, March 12, 2016 at 8:17:40 PM UTC+4, Alla _ wrote:
> On Saturday, March 12, 2016 at 8:10:58 PM UTC+4, Alla _ wrote:
> > I am still doing my best to understand how to form 
> > a table by attaching subsequent nodes (not putting 
> > a node at the beginning), but also looking into adding
> > another function that should check if the word from 
> > any given text is actually in the dictionary; for now
> > I use the load function that attaches nodes at the 
> > beginning, because it's the only working version I
> > have for the moment.
> > My question the load () actually returns a boolean
> > value, so it's not 
> > void load(const char *dictionary), as I had it, 
> > but bool load(const char *dictionary)
> > 
> > I have realized that I am not sure whether, after I have 
> > filled the hashtable with words by calling the load()
> > function, the table is available for all other functions,
> > because all operations inside load are done with 
> > pointers to hashtable structure, or it's not available.
> > I am not allowed to change function's declarations,
> > and bool check(const char* text_word) can't take any
> > other arguments; so to access hashtable values I can't 
> > call load again within check function. 
> > 
> > bool load(const char *dictionary)
> > {
> >     FILE *open_dict;
> >     node *new_node = NULL;
> >     ht *hashtable = NULL;
> >     char new_word[LENGTH] = {0};
> >     
> >     if ((open_dict = fopen(dictionary, "r")) != NULL)
> >     {
> >         if ((hashtable = create_table()) != NULL)
> >         {
> >             while (fscanf(open_dict, "%44s", new_word) == 1 &&
> >                    (new_node = create_node(new_word)) != NULL)
> >             {       
> >                   unsigned int hash_index = hash(new_word) % LISTS;
> >                     
> >                   if (empty_list(hashtable, hash_index))
> >                       hashtable->list[hash_index] = new_node;
> >                   else
> >                   {
> >                       new_node->next = hashtable->list[hash_index];
> >                       hashtable->list[hash_index] = new_node;
> >                   }
> >             
> >             }
> >             // free(hashtable); // return hashtable; (for later usage)
> >             return true;
> >         }
> >         else
> >         {
> >             printf("Couldn't create a table: out of memory\n");
> >             return false;
> >         }
> >         fclose(open_dict);
> >     }
> >     
> >     printf("Couldn't open dictionary\n");
> >     return false;
> > }
> > 
> >  Thank you!
> 
> Interesting: I definately can't access hashtable, because I never
> return it from the load function. Truly interesting. I'll be back
> on this - hope to come up with a good solution.

And global variables are a bad solution, as I have already learned.

[toc] | [prev] | [next] | [standalone]


#83748

FromBarry Schwarz <schwarzb@dqel.com>
Date2016-03-12 09:16 -0800
Message-ID<j9j8ebdifts46g2q7hrmk8ktg80f83ttr9@4ax.com>
In reply to#83745
On Sat, 12 Mar 2016 08:19:58 -0800 (PST), Alla _
<modelling.data@gmail.com> wrote:

>On Saturday, March 12, 2016 at 8:17:40 PM UTC+4, Alla _ wrote:
>> On Saturday, March 12, 2016 at 8:10:58 PM UTC+4, Alla _ wrote:
>> > I am still doing my best to understand how to form 
>> > a table by attaching subsequent nodes (not putting 
>> > a node at the beginning), but also looking into adding
>> > another function that should check if the word from 
>> > any given text is actually in the dictionary; for now
>> > I use the load function that attaches nodes at the 
>> > beginning, because it's the only working version I
>> > have for the moment.
>> > My question the load () actually returns a boolean
>> > value, so it's not 
>> > void load(const char *dictionary), as I had it, 
>> > but bool load(const char *dictionary)
>> > 
>> > I have realized that I am not sure whether, after I have 
>> > filled the hashtable with words by calling the load()
>> > function, the table is available for all other functions,
>> > because all operations inside load are done with 
>> > pointers to hashtable structure, or it's not available.
>> > I am not allowed to change function's declarations,
>> > and bool check(const char* text_word) can't take any
>> > other arguments; so to access hashtable values I can't 

Just out of curiosity, who is imposing these strange limitations?
There is whole bunch of "literature" dealing with the problems of
trying to implement a bad design.  It goes along with the horror
stories of management saying fix the problem but don't change
anything.

>> > call load again within check function. 
>> > 
>> > bool load(const char *dictionary)
>> > {
>> >     FILE *open_dict;
>> >     node *new_node = NULL;
>> >     ht *hashtable = NULL;
>> >     char new_word[LENGTH] = {0};
>> >     
>> >     if ((open_dict = fopen(dictionary, "r")) != NULL)
>> >     {
>> >         if ((hashtable = create_table()) != NULL)
>> >         {
>> >             while (fscanf(open_dict, "%44s", new_word) == 1 &&
>> >                    (new_node = create_node(new_word)) != NULL)
>> >             {       
>> >                   unsigned int hash_index = hash(new_word) % LISTS;
>> >                     
>> >                   if (empty_list(hashtable, hash_index))
>> >                       hashtable->list[hash_index] = new_node;
>> >                   else
>> >                   {
>> >                       new_node->next = hashtable->list[hash_index];
>> >                       hashtable->list[hash_index] = new_node;
>> >                   }
>> >             
>> >             }
>> >             // free(hashtable); // return hashtable; (for later usage)
>> >             return true;
>> >         }
>> >         else
>> >         {
>> >             printf("Couldn't create a table: out of memory\n");
>> >             return false;
>> >         }
>> >         fclose(open_dict);
>> >     }
>> >     
>> >     printf("Couldn't open dictionary\n");
>> >     return false;
>> > }
>> > 
>> >  Thank you!
>> 
>> Interesting: I definately can't access hashtable, because I never
>> return it from the load function. Truly interesting. I'll be back
>> on this - hope to come up with a good solution.
>
>And global variables are a bad solution, as I have already learned.

To my knowledge, there are only three portable ways to make the
address in hashtable available after load() returns:

   1 - Return the value.  Not possible because you cannot change the
return type.

   2 - Pass the address of a pointer to the function so the function
can update the pointer directly.  Not possible because you cannot add
a parameter to the function definition.

   3 - Store the address in global variable.  Not a desirable solution
but a POSSIBLE one.  Arthur Conan Doyle to the rescue.

-- 
Remove del for email

[toc] | [prev] | [next] | [standalone]


#83766

FromAlla _ <modelling.data@gmail.com>
Date2016-03-13 04:17 -0700
Message-ID<aecbe3df-7d05-45b7-ab2d-41b2cf7f2ff2@googlegroups.com>
In reply to#83748
On Saturday, March 12, 2016 at 9:16:26 PM UTC+4, Barry Schwarz wrote:
> On Sat, 12 Mar 2016 08:19:58 -0800 (PST), Alla _
> <modelling.data@gmail.com> wrote:
> 
> >On Saturday, March 12, 2016 at 8:17:40 PM UTC+4, Alla _ wrote:
> >> On Saturday, March 12, 2016 at 8:10:58 PM UTC+4, Alla _ wrote:
> >> > I am still doing my best to understand how to form 
> >> > a table by attaching subsequent nodes (not putting 
> >> > a node at the beginning), but also looking into adding
> >> > another function that should check if the word from 
> >> > any given text is actually in the dictionary; for now
> >> > I use the load function that attaches nodes at the 
> >> > beginning, because it's the only working version I
> >> > have for the moment.
> >> > My question the load () actually returns a boolean
> >> > value, so it's not 
> >> > void load(const char *dictionary), as I had it, 
> >> > but bool load(const char *dictionary)
> >> > 
> >> > I have realized that I am not sure whether, after I have 
> >> > filled the hashtable with words by calling the load()
> >> > function, the table is available for all other functions,
> >> > because all operations inside load are done with 
> >> > pointers to hashtable structure, or it's not available.
> >> > I am not allowed to change function's declarations,
> >> > and bool check(const char* text_word) can't take any
> >> > other arguments; so to access hashtable values I can't 
> 
> Just out of curiosity, who is imposing these strange limitations?
> There is whole bunch of "literature" dealing with the problems of
> trying to implement a bad design.  It goes along with the horror
> stories of management saying fix the problem but don't change
> anything.
> 
> >> > call load again within check function. 
> >> > 
> >> > bool load(const char *dictionary)
> >> > {
> >> >     FILE *open_dict;
> >> >     node *new_node = NULL;
> >> >     ht *hashtable = NULL;
> >> >     char new_word[LENGTH] = {0};
> >> >     
> >> >     if ((open_dict = fopen(dictionary, "r")) != NULL)
> >> >     {
> >> >         if ((hashtable = create_table()) != NULL)
> >> >         {
> >> >             while (fscanf(open_dict, "%44s", new_word) == 1 &&
> >> >                    (new_node = create_node(new_word)) != NULL)
> >> >             {       
> >> >                   unsigned int hash_index = hash(new_word) % LISTS;
> >> >                     
> >> >                   if (empty_list(hashtable, hash_index))
> >> >                       hashtable->list[hash_index] = new_node;
> >> >                   else
> >> >                   {
> >> >                       new_node->next = hashtable->list[hash_index];
> >> >                       hashtable->list[hash_index] = new_node;
> >> >                   }
> >> >             
> >> >             }
> >> >             // free(hashtable); // return hashtable; (for later usage)
> >> >             return true;
> >> >         }
> >> >         else
> >> >         {
> >> >             printf("Couldn't create a table: out of memory\n");
> >> >             return false;
> >> >         }
> >> >         fclose(open_dict);
> >> >     }
> >> >     
> >> >     printf("Couldn't open dictionary\n");
> >> >     return false;
> >> > }
> >> > 
> >> >  Thank you!
> >> 
> >> Interesting: I definately can't access hashtable, because I never
> >> return it from the load function. Truly interesting. I'll be back
> >> on this - hope to come up with a good solution.
> >
> >And global variables are a bad solution, as I have already learned.
> 
> To my knowledge, there are only three portable ways to make the
> address in hashtable available after load() returns:
> 
>    1 - Return the value.  Not possible because you cannot change the
> return type.
> 
>    2 - Pass the address of a pointer to the function so the function
> can update the pointer directly.  Not possible because you cannot add
> a parameter to the function definition.
> 
>    3 - Store the address in global variable.  Not a desirable solution
> but a POSSIBLE one.  Arthur Conan Doyle to the rescue.
> 
Exactly! I hoped that there might be a magic trick I didn't know about or
have forgotten - but you have confirmed that there are only these 3 options.
Initially when I have composed load(function) I missed the fact that it
is a boolean one, and can't return a hashtable. Seems that the only choice,
but still a bad one, is to use a global variable ((

Although I have planned to do it much later, to answer your questions on
who have imposed such rules, I publish the main program called speller.c
(I can't alter any line in it), a program dictionary.h and dictionary.c.
My task is to write functions in dictionary.c, which are then called by
the speller.c

speller.c

#include <ctype.h>
#include <stdio.h>
#include <sys/resource.h>
#include <sys/time.h>

#include "dictionary.h"
#undef calculate
#undef getrusage

// default dictionary
#define DICTIONARY "dictionaries/small1.txt"

// prototype
double calculate(const struct rusage* b, const struct rusage* a);

int main(int argc, char* argv[])
{
    // check for correct number of args
    if (argc != 2 && argc != 3)
    {
        printf("Usage: speller [dictionary] text\n");
        return 1;
    }

    // structs for timing data
    struct rusage before, after;

    // benchmarks
    double time_load = 0.0, time_check = 0.0, time_size = 0.0, time_unload = 0.0;

    // determine dictionary to use
    char* dictionary = (argc == 3) ? argv[1] : DICTIONARY;

    // load dictionary
    getrusage(RUSAGE_SELF, &before);
    bool loaded = load(dictionary);
    getrusage(RUSAGE_SELF, &after);

    // abort if dictionary not loaded
    if (!loaded)
    {
        printf("Could not load %s.\n", dictionary);
        return 1;
    }

    // calculate time to load dictionary
    time_load = calculate(&before, &after);

    // try to open text
    char* text = (argc == 3) ? argv[2] : argv[1];
    FILE* fp = fopen(text, "r");
    if (fp == NULL)
    {
        printf("Could not open %s.\n", text);
        unload();
        return 1;
    }

    // prepare to report misspellings
    printf("\nMISSPELLED WORDS\n\n");

    // prepare to spell-check
    int index = 0, misspellings = 0, words = 0;
    char word[LENGTH+1];

    // spell-check each word in text
    for (int c = fgetc(fp); c != EOF; c = fgetc(fp))
    {
        // allow only alphabetical characters and apostrophes
        if (isalpha(c) || (c == '\'' && index > 0))
        {
            // append character to word
            word[index] = c;
            index++;

            // ignore alphabetical strings too long to be words
            if (index > LENGTH)
            {
                // consume remainder of alphabetical string
                while ((c = fgetc(fp)) != EOF && isalpha(c));

                // prepare for new word
                index = 0;
            }
        }

        // ignore words with numbers (like MS Word can)
        else if (isdigit(c))
        {
            // consume remainder of alphanumeric string
            while ((c = fgetc(fp)) != EOF && isalnum(c));

            // prepare for new word
            index = 0;
        }

        // we must have found a whole word
        else if (index > 0)
        {
            // terminate current word
            word[index] = '\0';

            // update counter
            words++;

            // check word's spelling
            getrusage(RUSAGE_SELF, &before);
            bool misspelled = !check(word);
            getrusage(RUSAGE_SELF, &after);

            // update benchmark
            time_check += calculate(&before, &after);

            // print word if misspelled
            if (misspelled)
            {
                printf("%s\n", word);
                misspellings++;
            }

            // prepare for next word
            index = 0;
        }
    }

    // check whether there was an error
    if (ferror(fp))
    {
        fclose(fp);
        printf("Error reading %s.\n", text);
        unload();
        return 1;
    }

    // close text
    fclose(fp);

    // determine dictionary's size
    getrusage(RUSAGE_SELF, &before);
    unsigned int n = size();
    getrusage(RUSAGE_SELF, &after);

    // calculate time to determine dictionary's size
    time_size = calculate(&before, &after);

    // unload dictionary
    getrusage(RUSAGE_SELF, &before);
    bool unloaded = unload();
    getrusage(RUSAGE_SELF, &after);

    // abort if dictionary not unloaded
    if (!unloaded)
    {
        printf("Could not unload %s.\n", dictionary);
        return 1;
    }

    // calculate time to unload dictionary
    time_unload = calculate(&before, &after);

    // report benchmarks
    printf("\nWORDS MISSPELLED:     %d\n", misspellings);
    printf("WORDS IN DICTIONARY:  %d\n", n);
    printf("WORDS IN TEXT:        %d\n", words);
    printf("TIME IN load:         %.2f\n", time_load);
    printf("TIME IN check:        %.2f\n", time_check);
    printf("TIME IN size:         %.2f\n", time_size);
    printf("TIME IN unload:       %.2f\n", time_unload);
    printf("TIME IN TOTAL:        %.2f\n\n", 
     time_load + time_check + time_size + time_unload);

    // that's all folks
    return 0;
}

/**
 * Returns number of seconds between b and a.
 */
double calculate(const struct rusage* b, const struct rusage* a)
{
    if (b == NULL || a == NULL)
    {
        return 0.0;
    }
    else
    {
        return ((((a->ru_utime.tv_sec * 1000000 + a->ru_utime.tv_usec) -
                 (b->ru_utime.tv_sec * 1000000 + b->ru_utime.tv_usec)) +
                ((a->ru_stime.tv_sec * 1000000 + a->ru_stime.tv_usec) -
                 (b->ru_stime.tv_sec * 1000000 + b->ru_stime.tv_usec)))
                / 1000000.0);
    }
}

dictionary.h
#ifndef DICTIONARY_H
#define DICTIONARY_H

#include <stdbool.h>

// maximum length for a word
// (e.g., pneumonoultramicroscopicsilicovolcanoconiosis)
#define LENGTH 45

/**
 * Returns true if word is in dictionary else false.
 */
bool check(const char* word);

/**
 * Loads dictionary into memory.  Returns true if successful else false.
 */
bool load(const char* dictionary);

/**
 * Returns number of words in dictionary if loaded else 0 if not yet loaded.
 */
unsigned int size(void);

/**
 * Unloads dictionary from memory.  Returns true if successful else false.
 */
bool unload(void);

#endif // DICTIONARY_H

dictionary.c

#include <stdbool.h>

#include "dictionary.h"

/**
 * Returns true if word is in dictionary else false.
 */
bool check(const char* word)
{
    // TODO
    return false;
}

/**
 * Loads dictionary into memory.  Returns true if successful else false.
 */
bool load(const char* dictionary)
{
    // TODO
    return false;
}

/**
 * Returns number of words in dictionary if loaded else 0 if not yet loaded.
 */
unsigned int size(void)
{
    // TODO
    return 0;
}

/**
 * Unloads dictionary from memory.  Returns true if successful else false.
 */
bool unload(void)
{
    // TODO
    return false;
}

[toc] | [prev] | [next] | [standalone]


#83755

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2016-03-12 19:37 +0000
Message-ID<87wpp7a3nt.fsf@bsb.me.uk>
In reply to#83745
Alla _ <modelling.data@gmail.com> writes:

> On Saturday, March 12, 2016 at 8:17:40 PM UTC+4, Alla _ wrote:
>> On Saturday, March 12, 2016 at 8:10:58 PM UTC+4, Alla _ wrote:
>> > I am still doing my best to understand how to form 
>> > a table by attaching subsequent nodes (not putting 
>> > a node at the beginning), but also looking into adding
>> > another function that should check if the word from 
>> > any given text is actually in the dictionary; for now
>> > I use the load function that attaches nodes at the 
>> > beginning, because it's the only working version I
>> > have for the moment.
>> > My question the load () actually returns a boolean
>> > value, so it's not 
>> > void load(const char *dictionary), as I had it, 
>> > but bool load(const char *dictionary)
>> > 
>> > I have realized that I am not sure whether, after I have 
>> > filled the hashtable with words by calling the load()
>> > function, the table is available for all other functions,
>> > because all operations inside load are done with 
>> > pointers to hashtable structure, or it's not available.
>> > I am not allowed to change function's declarations,
>> > and bool check(const char* text_word) can't take any
>> > other arguments; so to access hashtable values I can't 
>> > call load again within check function. 
>> > 
>> > bool load(const char *dictionary)
>> > {
>> >     FILE *open_dict;
>> >     node *new_node = NULL;
>> >     ht *hashtable = NULL;
>> >     char new_word[LENGTH] = {0};
>> >     
>> >     if ((open_dict = fopen(dictionary, "r")) != NULL)
>> >     {
>> >         if ((hashtable = create_table()) != NULL)
>> >         {
>> >             while (fscanf(open_dict, "%44s", new_word) == 1 &&
>> >                    (new_node = create_node(new_word)) != NULL)
>> >             {       
>> >                   unsigned int hash_index = hash(new_word) % LISTS;
>> >                     
>> >                   if (empty_list(hashtable, hash_index))
>> >                       hashtable->list[hash_index] = new_node;
>> >                   else
>> >                   {
>> >                       new_node->next = hashtable->list[hash_index];
>> >                       hashtable->list[hash_index] = new_node;
>> >                   }
>> >             
>> >             }
>> >             // free(hashtable); // return hashtable; (for later usage)
>> >             return true;
>> >         }
>> >         else
>> >         {
>> >             printf("Couldn't create a table: out of memory\n");
>> >             return false;
>> >         }
>> >         fclose(open_dict);
>> >     }
>> >     
>> >     printf("Couldn't open dictionary\n");
>> >     return false;
>> > }
>> > 
>> >  Thank you!
>> 
>> Interesting: I definately can't access hashtable, because I never
>> return it from the load function.

And why is it being creating the load function?  Are you sure that is
the best place to do that?  If the load function loads words into an
existing table, I can call it with a list of English words and then add
proper names with another call.  It's not at all clear that one function
should create and load up the hash table.

>> Truly interesting. I'll be back
>> on this - hope to come up with a good solution.
>
> And global variables are a bad solution, as I have already learned.

At some point you've lost the whole top-down view of writing programs.
Long before I get to the code you have posted I would have quite few
sketches of the the parts might be like:

  main:
    create table
    scan the arguments
      if it's a dictionary
         add contents to dict
      else
         process text for missing words

That might turn into pseudo code shoing what needs to be passing and so
on:

  main:
    struct hash_table *dict = create_table();
    for each argument numbered a:
      if (argv[a] is "-d")
         load_word(dict, argv[a+1]);
         a += 1;
      else
         scan_text(dict, argv[a]);

And then load might be sketched

  load_word(dict, file)
     if (open file)
        while (can read word)
          add word to dict;
        close file;

and this would become something a little mode code-like:

  load_word(dict, file)
     if ((fp = fopen(file)) != NULL) {
        char word[???];
        while (get_word(fp, word))
          add_word(dict, word);
        fclose(fp);

and so on.  Eventually you get C code, but I will always know roughly
speaking where I am headed.  And I'll try to have as many high-level
notions as possible.  There will definitely be a function to to the hash
and one to look something up in it, and I'll have worked out how the
program usues these long before I start to write these two key parts.

-- 
Ben.

[toc] | [prev] | [next] | [standalone]


#83785

FromStephen Sprunk <stephen@sprunk.org>
Date2016-03-13 11:20 -0500
Message-ID<nc43q3$va3$1@dont-email.me>
In reply to#83755
On 12-Mar-16 13:37, Ben Bacarisse wrote:
> At some point you've lost the whole top-down view of writing
> programs. Long before I get to the code you have posted I would have
> quite few sketches of the the parts might be like:
> ...
> and so on.  Eventually you get C code, but I will always know
> roughly speaking where I am headed.  And I'll try to have as many
> high-level notions as possible.  There will definitely be a function
> to to the hash and one to look something up in it, and I'll have
> worked out how the program usues these long before I start to write
> these two key parts.

Thanks for explaining this because I realize it's the root of Alla's
problem moving from high-level concepts to code: there are steps in
between that either aren't being done or are being done incorrectly.

I go through the same general process in my head while reading the
requirements, or at most drawing block diagrams for really complex
problems, so it's not really a conscious process anymore--but that is
something that comes with experience; for a student, it should be in
writing* to learn the process and so the instructor can correct any
mistakes or, at worst, give partial credit.

* Yes, actual writing.  IMHO, paper or whiteboard is far superior to
typing for such purposes, but that's another debate.

S

-- 
Stephen Sprunk         "God does not play dice."  --Albert Einstein
CCIE #3723         "God is an inveterate gambler, and He throws the
K5SSS        dice at every possible opportunity." --Stephen Hawking

[toc] | [prev] | [next] | [standalone]


#83816

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2016-03-13 21:37 +0000
Message-ID<87a8m26ov7.fsf@bsb.me.uk>
In reply to#83785
Stephen Sprunk <stephen@sprunk.org> writes:

> On 12-Mar-16 13:37, Ben Bacarisse wrote:
Edited for clarity...
>> At some point you've lost the whole top-down view of writing
>> programs. Long before I get to the code you have posted I would have
>> quite few sketches of the parts might be like:
>> ...
>> and so on.  Eventually you get C code, but I will always know
>> roughly speaking where I am headed.  And I'll try to have as many
>> high-level notions as possible.  There will definitely be a function
>> to add to the hash. and one to look something up in it, and I'll have
>> worked out how the program uses these long before I start to write
>> these two key parts.
>
> Thanks for explaining this

Given the typos I now see in it I am surprised you followed it at all!

> because I realize it's the root of Alla's
> problem moving from high-level concepts to code: there are steps in
> between that either aren't being done or are being done incorrectly.
>
> I go through the same general process in my head while reading the
> requirements, or at most drawing block diagrams for really complex
> problems, so it's not really a conscious process anymore--but that is
> something that comes with experience; for a student, it should be in
> writing* to learn the process and so the instructor can correct any
> mistakes or, at worst, give partial credit.

Yes, it's easy to forget that, after decades of doing it, some of these
things will happen in my head almost without having to think about it.
You can run though a dozen design options to settle on one that (you
hope!) suits some particular situation without even realising that
you've rejected 11.

> * Yes, actual writing.  IMHO, paper or whiteboard is far superior to
> typing for such purposes, but that's another debate.

Me too.  The ability to annotate with drawings and marks makes writing
by hand and far more expressive way to capture ideas.  So far (at least
in my experience) no electronic device has been able to come close.  A
large tablet, with a good stylus and very responsive software is not far
off but still not quite there yet.

-- 
Ben.

[toc] | [prev] | [next] | [standalone]


#83749

FromMalcolm McLean <malcolm.mclean5@btinternet.com>
Date2016-03-12 09:48 -0800
Message-ID<5c0e59cf-0e7b-432c-b8dc-2e6303df8998@googlegroups.com>
In reply to#83744
On Saturday, March 12, 2016 at 4:17:40 PM UTC, Alla _ wrote:
>
> Interesting: I definately can't access hashtable, because I never
> return it from the load function. Truly interesting. I'll be back
> on this - hope to come up with a good solution.
>
You need to get into the habit of creating objects on the heap,
by allocating them with calls to malloc(), passing them around,
then destroying them.
In C, there's no support in the language itself for object creation, 
and destruction, but you can have two paired functions

ht *create_hashtable(/*possible creation parameters*/);
void destroy_hashtable(ht *hashtable);

then you always match a call to create with a call to destroy.
The hashtable is just a pointer, so it can be passed to 
other functions, like "add_entry()" or "retrive_entry().

Don't be afraid to allocate even very small and trivial structures
on the heap. It often makes program management a whole lot 
easier.




[toc] | [prev] | [next] | [standalone]


#83757

Fromraltbos@xs4all.nl (Richard Bos)
Date2016-03-12 20:31 +0000
Message-ID<56e47c2c.31726750@news.xs4all.nl>
In reply to#83749
Malcolm McLean <malcolm.mclean5@btinternet.com> wrote:

> On Saturday, March 12, 2016 at 4:17:40 PM UTC, Alla _ wrote:
> >
> > Interesting: I definately can't access hashtable, because I never
> > return it from the load function. Truly interesting. I'll be back
> > on this - hope to come up with a good solution.
> >
> You need to get into the habit of creating objects on the heap,

No, she needs to get into the habit of thinking first, designing second,
coding last. As it is she seems to have taught herself the habit of
deciding (or having decided for her, possibly) first, coding second,
wondering third, thinking as an afterthought.

That's the wrong order, and so is deciding you need to create anything
on the heap before you have thought about what the problem is.

Richard

[toc] | [prev] | [next] | [standalone]


#83758

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2016-03-12 21:18 +0000
Message-ID<87twkb8kec.fsf@bsb.me.uk>
In reply to#83749
Malcolm McLean <malcolm.mclean5@btinternet.com> writes:
<snip>
> In C, there's no support in the language itself for object creation, 
> and destruction, but you can have two paired functions

That may be true using your meanings for the words, but it isn't true
for the usual meanings as they apply to C.

To take one example talking about automatic storage duration objects:

  For such an object that does not have a variable length array type,
  its lifetime extends from entry into the block with which it is
  associated until execution of that block ends in any way. (Entering an
  enclosed block or calling a function suspends, but does not end,
  execution of the current block.) If the block is entered recursively,
  a new instance of the object is created each time.

And to take a more often overlooked example:

  plot_point(&(struct point){ x, x*2, 1/x });

<snip>
-- 
Ben.

[toc] | [prev] | [next] | [standalone]


#83760

FromStephen Sprunk <stephen@sprunk.org>
Date2016-03-12 17:54 -0600
Message-ID<nc2a27$4er$1@dont-email.me>
In reply to#83749
On 12-Mar-16 11:48, Malcolm McLean wrote:
> On Saturday, March 12, 2016 at 4:17:40 PM UTC, Alla _ wrote:
>> Interesting: I definately can't access hashtable, because I never
>> return it from the load function. Truly interesting. I'll be back
>> on this - hope to come up with a good solution.
>
> You need to get into the habit of creating objects on the heap,
> by allocating them with calls to malloc(), passing them around,
> then destroying them.

Agreed.

> In C, there's no support in the language itself for object creation, 
> and destruction, but you can have two paired functions
> 
> ht *create_hashtable(/*possible creation parameters*/);
> void destroy_hashtable(ht *hashtable);

Nit: I'd name them hashtable_create() and hashtable_destroy(), i.e. put
the object name first.  That's a common convention for C libaries, and
it will help if/when one moves on to another language with classes.

Also, one should have a set of generic linked list functions (probably
named list_something()) from previous exercises that could be reused
here for working within each bucket rather than reinventing the wheel.

> Don't be afraid to allocate even very small and trivial structures
> on the heap. It often makes program management a whole lot 
> easier.

Indeed; it's tempting to do everything on the stack (or worse, with
globals), but you're not really a C programmer unless you understand
pointers, and IMHO it's better to learn them early while you're still
working with relatively simple problems.  The longer you wait, the
harder it's going to be to catch up.

S

-- 
Stephen Sprunk         "God does not play dice."  --Albert Einstein
CCIE #3723         "God is an inveterate gambler, and He throws the
K5SSS        dice at every possible opportunity." --Stephen Hawking

[toc] | [prev] | [next] | [standalone]


#83767

FromAlla _ <modelling.data@gmail.com>
Date2016-03-13 04:25 -0700
Message-ID<ba778d15-44dc-4c85-a972-77a1b58f5148@googlegroups.com>
In reply to#83749
On Saturday, March 12, 2016 at 9:48:10 PM UTC+4, Malcolm McLean wrote:
> On Saturday, March 12, 2016 at 4:17:40 PM UTC, Alla _ wrote:
> >
> > Interesting: I definately can't access hashtable, because I never
> > return it from the load function. Truly interesting. I'll be back
> > on this - hope to come up with a good solution.
> >
> You need to get into the habit of creating objects on the heap,
> by allocating them with calls to malloc(), passing them around,
> then destroying them.
> In C, there's no support in the language itself for object creation, 
> and destruction, but you can have two paired functions
> 
> ht *create_hashtable(/*possible creation parameters*/);
> void destroy_hashtable(ht *hashtable);
> 
> then you always match a call to create with a call to destroy.
> The hashtable is just a pointer, so it can be passed to 
> other functions, like "add_entry()" or "retrive_entry().
> 
> Don't be afraid to allocate even very small and trivial structures
> on the heap. It often makes program management a whole lot 
> easier.

Yes. This is what I am doing in the load function, which is supported by
create_node() and create_table() functions, and later followed by 
unload() function. The problem is that I need the hashtable to 
be accessed by all functions, and the only way to do it (to my humble
knowledge at this stage) is to make hashtable a global variable, which
is a bad decision.

[toc] | [prev] | [next] | [standalone]


#83769

FromMalcolm McLean <malcolm.mclean5@btinternet.com>
Date2016-03-13 04:44 -0700
Message-ID<d713ef1e-774b-4665-91dc-55487a3f2fd0@googlegroups.com>
In reply to#83767
On Sunday, March 13, 2016 at 11:25:26 AM UTC, Alla _ wrote:
> On Saturday, March 12, 2016 at 9:48:10 PM UTC+4, Malcolm McLean wrote:
> > On Saturday, March 12, 2016 at 4:17:40 PM UTC, Alla _ wrote:
> > >
> > > Interesting: I definately can't access hashtable, because I never
> > > return it from the load function. Truly interesting. I'll be back
> > > on this - hope to come up with a good solution.
> > >
> > You need to get into the habit of creating objects on the heap,
> > by allocating them with calls to malloc(), passing them around,
> > then destroying them.
> > In C, there's no support in the language itself for object creation, 
> > and destruction, but you can have two paired functions
> > 
> > ht *create_hashtable(/*possible creation parameters*/);
> > void destroy_hashtable(ht *hashtable);
> > 
> > then you always match a call to create with a call to destroy.
> > The hashtable is just a pointer, so it can be passed to 
> > other functions, like "add_entry()" or "retrive_entry().
> > 
> > Don't be afraid to allocate even very small and trivial structures
> > on the heap. It often makes program management a whole lot 
> > easier.
> 
> Yes. This is what I am doing in the load function, which is supported by
> create_node() and create_table() functions, and later followed by 
> unload() function. The problem is that I need the hashtable to 
> be accessed by all functions, and the only way to do it (to my humble
> knowledge at this stage) is to make hashtable a global variable, which
> is a bad decision.
>
The way I would design a hashtable is like this (following Stephen Sprunk's
suggestion)

/*
   create a hash table. Pass in the size of the items you wish to store,
   and a capacity hint (table can grow bigger than the capacity or
   store fewer objects, it's just a hint to use for the table size)
   Return it (or null on out of memory)
*/
HT *hashtable_create(size_t element_size, int initial_capacity_hint)

/*
   Destry the hashtable create with the previous function.
   Free it and all its contents, but not secondary contents (pointers pionted
   to by items you strore.
*/
void hashtable_destroy(HT *h);

/*
   Add an item to the hashtable.
   h - the hash  table you created with hashtable_create
   key - the key of the item (always a string)
  item - the item itself.
  Note, the hash table does know anything about the item it is storing,
     just that they are always element_size bytes in size.

  Return -1 on failure (out of memory)
*/
int hash_table_add(HT *h, const char *key, void *item);

/*
   retrieve the element associated with the key, or NULL if it doesn't
     exist.
  You have to cast this pointer to whatever it is that you stored. Note, it
   is a pointer to the copy held in the hashtable, so if you modify it, you
   will modify the hastable's copy. To use your own copy, call memcpy.
*/
void *hashtable_find(HT *h, const char *key)


Now we can use this system with any object. We can store single C
variables or structures, all accessed via associated keys. You'll need 
to use malloc heavily, then in the destroy function, you'll have to free 
the web of pointers you have created. 

However that's how to design and package a hash table, once you've 
understood the basic principles on which they work.

[toc] | [prev] | [next] | [standalone]


#83794

FromStephen Sprunk <stephen@sprunk.org>
Date2016-03-13 12:31 -0500
Message-ID<nc47v9$g74$1@dont-email.me>
In reply to#83769
On 13-Mar-16 06:44, Malcolm McLean wrote:
> The way I would design a hashtable is like this (following Stephen
> Sprunk's suggestion)
> 
> /*
>    create a hash table. Pass in the size of the items you wish to
>    store, and a capacity hint (table can grow bigger than the
>    capacity or store fewer objects, it's just a hint to use for the
>    table size)
>    Return it (or null on out of memory)
> */
> HT *hashtable_create(size_t element_size, int initial_capacity_hint)

The capacity hint is a nice touch, but if the table adjusts its size
automatically as items are added, a hint seems like an unnecessary
(micro?)optimization.  If the table _doesn't_ adjust its size
automatically, then it's required, not a hint.

Why the requirement for a fixed element size?  If you're passing in the
value as a (void *), then why not let the caller manage that?

> /*
>    Destry the hashtable create with the previous function.
>    Free it and all its contents, but not secondary contents (pointers pionted
>    to by items you strore.
> */
> void hashtable_destroy(HT *h);

If you can't do a deep destroy (and I don't see how you could without
hard-coding the value's internals), then why free the first level?  It
seems like that would lead to misuse and memory leaks.

> /*
>    Add an item to the hashtable.
>    h - the hash  table you created with hashtable_create
>    key - the key of the item (always a string)
>   item - the item itself.
>   Note, the hash table does know anything about the item it is storing,
>      just that they are always element_size bytes in size.
> 
>   Return -1 on failure (out of memory)
> */
> int hash_table_add(HT *h, const char *key, void *item);

ITYM hashtable_add.

S

-- 
Stephen Sprunk         "God does not play dice."  --Albert Einstein
CCIE #3723         "God is an inveterate gambler, and He throws the
K5SSS        dice at every possible opportunity." --Stephen Hawking

[toc] | [prev] | [next] | [standalone]


Page 5 of 17 — ← Prev page 1 … 3 4 [5] 6 7 … 17  Next page →

Back to top | Article view | comp.lang.c


csiph-web