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


Groups > comp.lang.javascript > #33936 > unrolled thread

Counter or Index?

Started byjonas.thornvall@gmail.com
First post2017-09-01 21:57 -0700
Last post2017-09-21 05:32 -0700
Articles 2 on this page of 22 — 2 participants

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


Contents

  Counter or Index? jonas.thornvall@gmail.com - 2017-09-01 21:57 -0700
    Re: Counter or Index? jonas.thornvall@gmail.com - 2017-09-02 00:05 -0700
      Re: Counter or Index? jonas.thornvall@gmail.com - 2017-09-02 00:34 -0700
        Re: Counter or Index? jonas.thornvall@gmail.com - 2017-09-02 07:10 -0700
          Re: Counter or Index? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-09-02 15:32 +0100
            Re: Counter or Index? jonas.thornvall@gmail.com - 2017-09-02 07:48 -0700
              Re: Counter or Index? jonas.thornvall@gmail.com - 2017-09-02 08:13 -0700
                Re: Counter or Index? jonas.thornvall@gmail.com - 2017-09-02 08:18 -0700
            Re: Counter or Index? jonas.thornvall@gmail.com - 2017-09-02 08:52 -0700
            Re: Counter or Index? jonas.thornvall@gmail.com - 2017-09-02 09:42 -0700
            Re: Counter or Index? jonas.thornvall@gmail.com - 2017-09-02 09:54 -0700
              Re: Counter or Index? jonas.thornvall@gmail.com - 2017-09-02 10:17 -0700
                Re: Counter or Index? jonas.thornvall@gmail.com - 2017-09-03 13:41 -0700
                  Re: Counter or Index? jonas.thornvall@gmail.com - 2017-09-03 13:58 -0700
                    Re: Counter or Index? jonas.thornvall@gmail.com - 2017-09-03 14:09 -0700
                      Re: Counter or Index? jonas.thornvall@gmail.com - 2017-09-03 14:17 -0700
                        Re: Counter or Index? jonas.thornvall@gmail.com - 2017-09-03 14:33 -0700
                          Re: Counter or Index? jonas.thornvall@gmail.com - 2017-09-05 01:33 -0700
                            Re: Counter or Index? jonas.thornvall@gmail.com - 2017-09-15 18:05 -0700
                              Re: Counter or Index? jonas.thornvall@gmail.com - 2017-09-15 18:06 -0700
                              Re: Counter or Index? jonas.thornvall@gmail.com - 2017-09-15 18:12 -0700
                                Re: Counter or Index? jonas.thornvall@gmail.com - 2017-09-21 05:32 -0700

Page 2 of 2 — ← Prev page 1 [2]


#33990

Fromjonas.thornvall@gmail.com
Date2017-09-15 18:12 -0700
Message-ID<af49f9bd-9c7b-4ae3-8cb1-77fed3cce6bc@googlegroups.com>
In reply to#33988
Den lördag 16 september 2017 kl. 03:05:33 UTC+2 skrev jonas.t...@gmail.com:
> Den tisdag 5 september 2017 kl. 10:33:14 UTC+2 skrev jonas.t...@gmail.com:
> > Den söndag 3 september 2017 kl. 23:33:09 UTC+2 skrev jonas.t...@gmail.com:
> > > Den söndag 3 september 2017 kl. 23:17:50 UTC+2 skrev jonas.t...@gmail.com:
> > > > Den söndag 3 september 2017 kl. 23:09:27 UTC+2 skrev jonas.t...@gmail.com:
> > > > > Den söndag 3 september 2017 kl. 22:58:50 UTC+2 skrev jonas.t...@gmail.com:
> > > > > > Den söndag 3 september 2017 kl. 22:41:52 UTC+2 skrev jonas.t...@gmail.com:
> > > > > > > Den lördag 2 september 2017 kl. 19:17:26 UTC+2 skrev jonas.t...@gmail.com:
> > > > > > > > Den lördag 2 september 2017 kl. 18:54:41 UTC+2 skrev jonas.t...@gmail.com:
> > > > > > > > > Den lördag 2 september 2017 kl. 16:33:05 UTC+2 skrev Ben Bacarisse:
> > > > > > > > > > jonas.thornvall@gmail.com writes:
> > > > > > > > > > 
> > > > > > > > > > > Lets see who can first can write an algorithm in head "or javascript
> > > > > > > > > > > ;)" that read out all the words in alpahbetical order.
> > > > > > > > > > >
> > > > > > > > > > > [b[a[l[l*]][n[a[n[a*]]]][t*]][u[n*][t[t*]
> > > > > > > > > > 
> > > > > > > > > > What does this notation mean?
> > > > > > > > > > 
> > > > > > > > > > <snip>
> > > > > > > > > > > Is there a name for this type of branching string datastructure?
> > > > > > > > > > > I mean it does not need to store words, it could store chessgames or
> > > > > > > > > > > whatever branching structure, so it must be known. Well it certainly
> > > > > > > > > > > not a binary tree it is a branching tree, so what is the name?
> > > > > > > > > > 
> > > > > > > > > > When used for searching, any branching tree is simply called a search
> > > > > > > > > > tree.  There are many much more specific terms depending on how the data
> > > > > > > > > > are organised in the tree.  There are AVL trees, red-black trees, suffix
> > > > > > > > > > trees and so on.  For words, I suspect the one you are looking for is
> > > > > > > > > > called a trie.
> > > > > > > > > > 
> > > > > > > > > > I don't think there is a standard name for a tree where the number of
> > > > > > > > > > possible branches varies depending on where in the tree a node appears
> > > > > > > > > > (as one might use for chess games).  It's just the tree of possible
> > > > > > > > > > moves.
> > > > > > > > > > 
> > > > > > > > > > -- 
> > > > > > > > > > Ben.
> > > > > > > > > 
> > > > > > > > > Are trie trees used in AI development Ben, it seem easy to weigh the outcome as you read in "trials"? Well i am going for an algorithm working on simple string with the advantage it can be saved down to file without any formatting "beside creation".
> > > > > > > > > 
> > > > > > > > > What is the most efficient way in javascript, can you branch arrays? But then you have the hussle  to format and store them and read them in? Here just the blob saved, i kind of like that but i guess performance wise it is hardly optimal to use a sting especially if it not indexed with levels?
> > > > > > > > 
> > > > > > > > Well i may make a version using indexed levels instead once i finished the one with delimiters just to see how they compare.
> > > > > > > 
> > > > > > > Just finished the algorithm to read thru string structure and i think i have all vital values to insert a new stringitem.
> > > > > > > 
> > > > > > > Apparently there will be two special cases inserts before and after the string structure.
> > > > > > 
> > > > > > This will just read out the words from the string structure.
> > > > > > But it will definitly make it easier to position to put in new words character by character into structure.
> > > > > > 
> > > > > > [b[a[l[l*]][n[a[n[a*]]]][t*]][u[n*][t[t*]
> > > > > > 
> > > > > > function searchReadThru() {
> > > > > >     for (z = 0; z < encodedString.length; z++) {
> > > > > >         if (encodedString.charAt(z) == "[") {
> > > > > >             oldlevel=deeplevel;
> > > > > >             deeplevel++;
> > > > > >             alert("Level added"+deeplevel+" "+oldlevel+" "+stringNextMem);
> > > > > >         } else if (encodedString.charAt(z) == "]") {
> > > > > >             oldlevel=deeplevel;
> > > > > >             deeplevel--;
> > > > > >             stringNextMem = stringNextMem.slice(0, -1);
> > > > > >             alert("Level revoked "+deeplevel+" "+oldlevel+" "+stringNextMem);
> > > > > >         } else if (encodedString.charAt(z) == "*") {
> > > > > >             alert("End word "+deeplevel+" "+oldlevel+" "+stringNextMem);
> > > > > >         } else {
> > > > > >             stringPrevMem = stringNextMem;
> > > > > >             stringNextMem += encodedString.charAt(z);
> > > > > >             alert("Newchar "+deeplevel+" "+oldlevel+" "+stringNextMem);
> > > > > >         }
> > > > > 
> > > > > Any new item i guess would be inserted here or? 
> > > > > insertItem();
> > > > 
> > > > Well any new check for in correct position to insert, so..
> > > > 
> > > > if (encodedString.charAt(z) != "[" && encodedString.charAt(z) != "]" && encodedString.charAt(z) != "*") checkIfInsert(); 
> > > > 
> > > > There is probably technics to search in alot faster for right spot then linear progression thru the string "if it is a big file"...
> > > > 
> > > > But it is a start.
> > > > 
> > > > 
> > > > >           -
> > > > > >     }
> > > > > > }
> > > 
> > > But for most games and board games like chess the number of openings is limited so if you read in board games linear progression will work good for inserts, i see there is about 12-15 in chess.
> > 
> > A bit further i think i managed to position the and readout the input string so that it develop and follow the structure already in place and find the spot where the substring "character by character" readout structure get bigger then the readin substring, well the place todo the insert.
> > 
> > Now it is just a matter of howto format the input string with brackets there could be a few cases.
> 
> My ideas so good they are 30 years old.
> 
> https://www.youtube.com/watch?v=Bm7zah_LrmE

They make it far to hard though. It is much easier-

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


#34002

Fromjonas.thornvall@gmail.com
Date2017-09-21 05:32 -0700
Message-ID<87cccb15-e6bb-42ef-aa64-03cb98f9749b@googlegroups.com>
In reply to#33990
Den lördag 16 september 2017 kl. 03:12:43 UTC+2 skrev jonas.t...@gmail.com:
> Den lördag 16 september 2017 kl. 03:05:33 UTC+2 skrev jonas.t...@gmail.com:
> > Den tisdag 5 september 2017 kl. 10:33:14 UTC+2 skrev jonas.t...@gmail.com:
> > > Den söndag 3 september 2017 kl. 23:33:09 UTC+2 skrev jonas.t...@gmail.com:
> > > > Den söndag 3 september 2017 kl. 23:17:50 UTC+2 skrev jonas.t...@gmail.com:
> > > > > Den söndag 3 september 2017 kl. 23:09:27 UTC+2 skrev jonas.t...@gmail.com:
> > > > > > Den söndag 3 september 2017 kl. 22:58:50 UTC+2 skrev jonas.t...@gmail.com:
> > > > > > > Den söndag 3 september 2017 kl. 22:41:52 UTC+2 skrev jonas.t...@gmail.com:
> > > > > > > > Den lördag 2 september 2017 kl. 19:17:26 UTC+2 skrev jonas.t...@gmail.com:
> > > > > > > > > Den lördag 2 september 2017 kl. 18:54:41 UTC+2 skrev jonas.t...@gmail.com:
> > > > > > > > > > Den lördag 2 september 2017 kl. 16:33:05 UTC+2 skrev Ben Bacarisse:
> > > > > > > > > > > jonas.thornvall@gmail.com writes:
> > > > > > > > > > > 
> > > > > > > > > > > > Lets see who can first can write an algorithm in head "or javascript
> > > > > > > > > > > > ;)" that read out all the words in alpahbetical order.
> > > > > > > > > > > >
> > > > > > > > > > > > [b[a[l[l*]][n[a[n[a*]]]][t*]][u[n*][t[t*]
> > > > > > > > > > > 
> > > > > > > > > > > What does this notation mean?
> > > > > > > > > > > 
> > > > > > > > > > > <snip>
> > > > > > > > > > > > Is there a name for this type of branching string datastructure?
> > > > > > > > > > > > I mean it does not need to store words, it could store chessgames or
> > > > > > > > > > > > whatever branching structure, so it must be known. Well it certainly
> > > > > > > > > > > > not a binary tree it is a branching tree, so what is the name?
> > > > > > > > > > > 
> > > > > > > > > > > When used for searching, any branching tree is simply called a search
> > > > > > > > > > > tree.  There are many much more specific terms depending on how the data
> > > > > > > > > > > are organised in the tree.  There are AVL trees, red-black trees, suffix
> > > > > > > > > > > trees and so on.  For words, I suspect the one you are looking for is
> > > > > > > > > > > called a trie.
> > > > > > > > > > > 
> > > > > > > > > > > I don't think there is a standard name for a tree where the number of
> > > > > > > > > > > possible branches varies depending on where in the tree a node appears
> > > > > > > > > > > (as one might use for chess games).  It's just the tree of possible
> > > > > > > > > > > moves.
> > > > > > > > > > > 
> > > > > > > > > > > -- 
> > > > > > > > > > > Ben.
> > > > > > > > > > 
> > > > > > > > > > Are trie trees used in AI development Ben, it seem easy to weigh the outcome as you read in "trials"? Well i am going for an algorithm working on simple string with the advantage it can be saved down to file without any formatting "beside creation".
> > > > > > > > > > 
> > > > > > > > > > What is the most efficient way in javascript, can you branch arrays? But then you have the hussle  to format and store them and read them in? Here just the blob saved, i kind of like that but i guess performance wise it is hardly optimal to use a sting especially if it not indexed with levels?
> > > > > > > > > 
> > > > > > > > > Well i may make a version using indexed levels instead once i finished the one with delimiters just to see how they compare.
> > > > > > > > 
> > > > > > > > Just finished the algorithm to read thru string structure and i think i have all vital values to insert a new stringitem.
> > > > > > > > 
> > > > > > > > Apparently there will be two special cases inserts before and after the string structure.
> > > > > > > 
> > > > > > > This will just read out the words from the string structure.
> > > > > > > But it will definitly make it easier to position to put in new words character by character into structure.
> > > > > > > 
> > > > > > > [b[a[l[l*]][n[a[n[a*]]]][t*]][u[n*][t[t*]
> > > > > > > 
> > > > > > > function searchReadThru() {
> > > > > > >     for (z = 0; z < encodedString.length; z++) {
> > > > > > >         if (encodedString.charAt(z) == "[") {
> > > > > > >             oldlevel=deeplevel;
> > > > > > >             deeplevel++;
> > > > > > >             alert("Level added"+deeplevel+" "+oldlevel+" "+stringNextMem);
> > > > > > >         } else if (encodedString.charAt(z) == "]") {
> > > > > > >             oldlevel=deeplevel;
> > > > > > >             deeplevel--;
> > > > > > >             stringNextMem = stringNextMem.slice(0, -1);
> > > > > > >             alert("Level revoked "+deeplevel+" "+oldlevel+" "+stringNextMem);
> > > > > > >         } else if (encodedString.charAt(z) == "*") {
> > > > > > >             alert("End word "+deeplevel+" "+oldlevel+" "+stringNextMem);
> > > > > > >         } else {
> > > > > > >             stringPrevMem = stringNextMem;
> > > > > > >             stringNextMem += encodedString.charAt(z);
> > > > > > >             alert("Newchar "+deeplevel+" "+oldlevel+" "+stringNextMem);
> > > > > > >         }
> > > > > > 
> > > > > > Any new item i guess would be inserted here or? 
> > > > > > insertItem();
> > > > > 
> > > > > Well any new check for in correct position to insert, so..
> > > > > 
> > > > > if (encodedString.charAt(z) != "[" && encodedString.charAt(z) != "]" && encodedString.charAt(z) != "*") checkIfInsert(); 
> > > > > 
> > > > > There is probably technics to search in alot faster for right spot then linear progression thru the string "if it is a big file"...
> > > > > 
> > > > > But it is a start.
> > > > > 
> > > > > 
> > > > > >           -
> > > > > > >     }
> > > > > > > }
> > > > 
> > > > But for most games and board games like chess the number of openings is limited so if you read in board games linear progression will work good for inserts, i see there is about 12-15 in chess.
> > > 
> > > A bit further i think i managed to position the and readout the input string so that it develop and follow the structure already in place and find the spot where the substring "character by character" readout structure get bigger then the readin substring, well the place todo the insert.
> > > 
> > > Now it is just a matter of howto format the input string with brackets there could be a few cases.
> > 
> > My ideas so good they are 30 years old.
> > 
> > https://www.youtube.com/watch?v=Bm7zah_LrmE
> 
> They make it far to hard though. It is much easier-

Evidently people do read my ravings, maybe they expect me to present the solution?

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

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


csiph-web