Skip to content

Instantly share code, notes, and snippets.

@jamesiter
Created March 26, 2018 21:43
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 jamesiter/58a0424e821d72f5512ecff1f1d755e6 to your computer and use it in GitHub Desktop.
Save jamesiter/58a0424e821d72f5512ecff1f1d755e6 to your computer and use it in GitHub Desktop.
元素 e 的深度,为同辈兄长的深度,加兄长及其兄长孩子的数量,长子不计其数。
当元素 e 没有同辈兄长时,则继承父辈的深度。
比如:
1、兄长的深度为 2,有 3 个孩子。则 e 的深度为 2(兄长深度) + 3(孩子数量) - 1(长子) + 1(兄长自己) = 5。
2、兄长的深度为 1,有 1 个孩子。则 e 的深度为 1(兄长深度) + 1(孩子数据) - 1(长子) + 1(兄长自己) = 2。
3、兄长的深度为 1,没有孩子。则 e 的深度为 1(兄长深度) + 1(兄长自己) = 2。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment