Graduate Algorithm to Pair Even Boolean Array Elements

  • Thread starter Thread starter intervoxel
  • Start date Start date
  • Tags Tags
    Algorithm
Click For Summary
An algorithm is needed to pair even boolean array elements, specifically to return the address of a true value that corresponds to another true value in a cyclic manner. Given an address of a true value, the algorithm should return the address of another true value without storing previous choices. By counting the number of true values, N, the algorithm can return the address of the N/2 th true value relative to the starting address. This ensures that each true value pairs with another true value equidistantly. The solution is designed for use in a cellular automaton context.
intervoxel
Messages
192
Reaction score
1
Suppose an array of booleans with an even number of true values. I need an algorithm that, given an address containing a true (say, 3), returns the address of another true (say, 25), such that if I call the algorithm for 25, it returns 3. No storage of old choices are allowed since this algorithm will be used in a cellular automaton.

Thanks for any help.
 
Physics news on Phys.org
If you know, or count, the number of true values, call it N, then if the function returns the address of the N/2 th true value after the starting value counting cyclically, then each true value will pair with a true value the same number of places above and below.
 
  • Like
Likes intervoxel
The standard _A " operator" maps a Null Hypothesis Ho into a decision set { Do not reject:=1 and reject :=0}. In this sense ( HA)_A , makes no sense. Since H0, HA aren't exhaustive, can we find an alternative operator, _A' , so that ( H_A)_A' makes sense? Isn't Pearson Neyman related to this? Hope I'm making sense. Edit: I was motivated by a superficial similarity of the idea with double transposition of matrices M, with ## (M^{T})^{T}=M##, and just wanted to see if it made sense to talk...

Similar threads

Replies
9
Views
3K
Replies
235
Views
14K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 17 ·
Replies
17
Views
3K
Replies
5
Views
2K
  • · Replies 29 ·
Replies
29
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 21 ·
Replies
21
Views
3K