Your IP is:

Modified Preorder Traversal Tree (MPTT) - Introduction

Modified Preorder Traversal Tree is a technique for representing nested data in a relational database. A very common example is the hierarchy of menus in a complex website.

The idea here is the flow of sequential numbers from left to right.




3-British Columbia-8                            9-Ontario-12

4-Vancouver-5        6-Richmond-7      10-Toronto-11


As you can see the numbers move sequentially from the left to the child nodes until no node exists and then it traverses back to the parent.         

Country is the Parent node for all the nodes under it. 

Now, if we try to insert another province the tree would be as under:



3-British Columbia-8                           9-Ontario-12        13-Quebec-14

4-Vancouver-5       6-Richmond-7      10-Toronto-11

The drawback of this method is that with every insertion, deletion or alteration of any node, the entire tree needs to be rearranged.