Skip to content

Instantly share code, notes, and snippets.

@lovisgod
Last active March 11, 2020 04:16
Show Gist options
  • Save lovisgod/3c1fc98c99f486c892a5366f2f62f09f to your computer and use it in GitHub Desktop.
Save lovisgod/3c1fc98c99f486c892a5366f2f62f09f to your computer and use it in GitHub Desktop.

if a user registers, he has a referer. a referer can only get two direct down-lines. a user must have six down-lines to complete stage one. a registered user is related to one direct up-line. how do we get all down-lines that are not directly under a user but related to the user.

example

a = b, c

b = d, f

c = e, g

d,f, e, g are not directly related to a but are related because the are related to the children of a which is b and c

a referer = null

b referer = a

c referer = a

d referer = b

f referer = b

e referer = c

g referer = c

the problem is how to know that d,f,e, g are also down-lines of a even though they are not direct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment