a special type of strings!
- To: mathgroup at smc.vnet.net
- Subject: [mg78704] a special type of strings!
- From: mumat <csarami at gmail.com>
- Date: Sat, 7 Jul 2007 06:04:45 -0400 (EDT)
Hi Everyone, I have an alphabet A= {a,b,c,d,e,f,g,h}. letters in A are grouped as follows: group1: G1={a} group2:G2={b,c}, group3:G3={d,e,f}, group4: G4={g,h}. In other words, we have {{a},{b,c},{d,e,f},{g,h}} as an ordered partition of A. We say the string \alpha=s_1,s_2,s_3,...,s_n to be NORMAL if and only if for every i,j: ( if s_i is in Gj then, (s_(i+1) is in Gj or s_(i+1) is in G(j-1) ) OR (s_i is in G1). For instance the following three sequences are normal: Seq1: d,b,a,g,e,f,c,a,e Seq2: a,d,b,a,b,e,c,a,h. Seq3: g,g,h,d,f,d,b,c. I need to write a code to determine weather a given sequence is Normal: NormalQ[seq_]:=.... and also generating all normal sequences of a particular length k: AllNormalSequences[k]. Any help would be greately appreciated. best regards, chekad sarami