Home > database >  Linked list data structure of binary tree storage
Linked list data structure of binary tree storage

Time:10-06

Do this have what good method?

CodePudding user response:

(1) to calculate the binary tree layer n
(2) to calculate the last layer of the junction points k
(3) to calculate the reciprocal of the second layer nodes m
(4) if k is odd: the second from bottom of leaf nodes of the m - 1 - (k - 1)/2, all the leaf nodes of the m - 1 - (k - 1)/2 + k
Pointer field is empty: [m - 1 - (k - 1)/2 + k] * 2 + 1
If k is even: the second from bottom of leaf nodes for the m - k/2, all the leaf nodes of the m - k/2 + k
Pointer field is empty: (m + k/2) * 2
  • Related