| Algorithm 1. Pseudo-code for k-tree construction |
|
input: D output: 1. ← create a new node with 2. for D 3. ← ( 4. end for 5. function 6. 7. while i ≤ || do 8. if > then //full match, so travel deeper// 9. if = “0” then //travel left child// 10. ← (,) 11. else if = “1” then //travel right child// 12. ← (, d) 13. end if 14. break while 15. else if ≠ then //partial match, so do splitting // 16. ← a new node //create a new node for splitting// 17. if = “0” then //create a left child// 18. ← create a new node 19. ← 20. else if 1” then //create a right child// 21. ← create a new node 22. ← 23. end if 24. adjust , , for nodes m, , and 25. 26. break while 27. end if 28. 29. end while 30. output 31. end function |