Skip to content

Instantly share code, notes, and snippets.

@iximiuz
Created June 24, 2018 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iximiuz/c01cbb5a849dd01cf340654ede113a8c to your computer and use it in GitHub Desktop.
Save iximiuz/c01cbb5a849dd01cf340654ede113a8c to your computer and use it in GitHub Desktop.
i => j1 = 2*i           0 => 0     1 => 2    2 => 4
     j2 = 2*i+1         0 => 1     1 => 3    2 => 5

i = j//2                0 => 0     2 => 1    4 => 2
                        1 => 0     3 => 1    5 => 2


i => j1 = 2*i + 1       0 => 1    1 => 3    2 => 5
     j2 = 2*i + 2       0 => 2    1 => 4    2 => 6

i = (j - 1) // 2        1 => 0    3 => 1    5 => 2
                        2 => 0    4 => 1    6 => 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment