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


Groups > comp.lang.javascript > #33939

Re: Counter or Index?

Newsgroups comp.lang.javascript
Date 2017-09-02 07:10 -0700
References <2274405e-c00f-4c91-9b6b-0c4ab7577be8@googlegroups.com> <553d4a12-4ab8-44c3-8d16-9a29b53919ea@googlegroups.com> <98e08a5a-80ac-4691-8a16-2a24e7502eb4@googlegroups.com>
Message-ID <5cc7477b-1e70-4d07-aa2d-8bd76b85a200@googlegroups.com> (permalink)
Subject Re: Counter or Index?
From jonas.thornvall@gmail.com

Show all headers | View raw


Den lördag 2 september 2017 kl. 09:34:17 UTC+2 skrev jonas.t...@gmail.com:
> Den lördag 2 september 2017 kl. 09:05:38 UTC+2 skrev jonas.t...@gmail.com:
> > Den lördag 2 september 2017 kl. 06:57:47 UTC+2 skrev jonas.t...@gmail.com:
> > > I am writing some string manipulation algorithms that have are heavily branched to hold like say a chessrecords or other similar structured datasets of information.
> > > 
> > > Should one index the deep of branch or let the algorithm keep track of the depth using delimiters?
> > > It seem that index will take extra space, but searching the information will be alot faster because the algorithm do not need the to keep track of search depth? 
> > > 
> > > I do realise that this problem probably implemented in pointer structures and maybe in javascript using arrays with subelements/arrays.
> > > 
> > > But i remember doing this type of thing in Basic decades ago, and would check if my brain still up to the task doing it using just string handling.
> > > 
> > > Use dataIndex or algorithm counter to keep track of the depth of data in the set?
> > 
> > Well i settled for to first try have the algorithm keep track of level and position, but to be able to put in new "moves" or "records" at correct place not only the level is important, it must also know where it is in the structure so a backtrack record "while searching" must always be there. 
> > 
> > Otherwise you are lost in the structure. So the search algorithm knows where it is in the structure by building the search in memory, it seem simple enough on the surface, we will see how it turn out.
> 
> I will solve it by having memoryString.charAt(deeplevel)=encodedString.charAt(z);
> This way the actual built structure while searching always in memory, and can be compared with the structure you want to put in.
> 
> It could be a chessmove, following from a sequense of chessmoves or a character in a word following from other characters already stored within structure.
> 
> Is there a name other the branching for these type of tree structures, like to have a dictionary branched using the characters of similar words in a tree structure with just a terminator for finished completed words?
> 
> So A will only be stored once for every word starting with an A, if the second character is N it will only be stored once? Of course you need delimiters so it could be questionable how much space it actually solves.
> 
> But the nice thing is you could read in chess games into the structure starting with the first party you can set a weight to the individual move "depending upon if black or white wins" so the first game you read in have 100% =1 for each move of the color that win say white and 0% for each move for the color that lose.
> After that you weigh "compare" new entries so if next game you read in to the structure so if next game do same 4 moves but after them black wins now the chance of the 4 moves in the chessbook adjusted to 50% but then it branch to 100% for all black moves and so on "of course you need to know how many games each "move at the level represent" to set the weigth "percentage correct". 
> 
> But say you have a few million chess games read into the structure, you could actually tell the chance to win because every move would be weighted against the moves already read in to the structure.
> 
> 
> So as you read in the games you get a weighted openingbook, without even the need to analyse it further.
> 
> 
> Does it seem sensible?

Been fiddling going direct on the insert did not prove succesfull, this project is going nowhere until i actually can search thru and read out all the words strored. So i will implement a search using a structure created from mind,  i think that is the way todo it because the search will just mirror what is read out from the array. It will be a later *easier* problem to actually put things in.

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*]

Is this structure general? Of course the "recurring end" paragraps could be replace with special signs for ]],]]],]]]],]]]]] and so on to save space. 

I try write a program that search thru structure to begin with, and pick out the words within it. I just did it my head so i may have missed a paragraph.

From there you can start to compare with the word you want to read in "and maybe start to insert characters into the structure.

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?

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web