Sequence traversal, or fully structured triplicate tree

Source: Internet
Author: User
Sequence traversal, or the storage structure of the triplicate tree, is as follows | id | parent | l_child | m_child | r_child | & nbsp; I need to specify a node and insert a child node, the minimum distance between the node and the specified node is required, and the node is traversed according to the priority sequence, or a complete triples tree is constructed.
The storage structure of the Sankey tree is as follows:


| Id | parent | l_child | m_child | r_child |



Now I need to specify a node and insert a child node, which requires that the node be the least distance from the specified node and be inserted in the order of priority l-> m-> r, that is, when the number of inserted nodes reaches a certain number, it can become a completely Triple Tree.

------ Solution --------------------
....

}
}
Return a ($ tree, $ uid );
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.