Input: FMKS = |
WildCard Fuzzy Multikeyword Set |
Output: : BTree Wildcard Fuzzy Searchable Index |
(1) Start AddNodeBTree |
(2) Declare the ChildLimit, NumberofChild, ChildrenValue inside the class BTreeNode |
(3) Declare TreeHeight to denote height of the BTree, ; |
(4) Declare the objects KeyNumber, KeyIndex, NodeValue, NextNode, RootNode for AddNode |
(5) Declare KeyIndexNumber that denote the number of keyIndex and Nodevalue pairs in B Tree |
(6) Declare the object ChildrenNodeValue for the class AddNode |
(7) Define Constructor AddNode(KeyIndex, NodeValue, NextNode) |
(8) this.KeyIndex = KeyIndex; |
(9) this.NodeValue = NodeValue; |
(10) this.NextNode =NextNode; |
(11) End ConstrutorAddNode |
(12) Initialize RootNode = new Node() |
(13) for to Number of keywords in FMKS[] do |
(14) for to Number of Fuzzy Keywords in FMKS |
(15) call InsertNodeIntoBTree(RootNode, FMKS[], FMKS, TreeHeight) |
(16) Receive BTreeNode; |
(17) KeyIndexnumber = KeyIndexnumber + 1; |
(18) if (BTreeNode == NULL) then |
(19) return NULL; |
(20) end if |
(21) Create two AddNode object as ChildNode |
(22) ChildNode.childrenNodeValue = new AddNode(RootNode.childrenNodeValue.KeyIndex, |
Null, RootNode); |
(23) ChildNode. childrenNodeValue = new AddNode(u. childrenNodeValue.KeyIndex, null, |
BTreeNode); |
(24) RootNode = ChildNode; |
(25) TreeHeight = TreeHeight + 1; |
(26) End AddNodeBTree |
(27) Function AddNodeInsertNodeIntoBTree (RootNode, WFKS, WFKS, TreeHeight) |
(28) Declare the variable for processing loop |
(29) for to Number of keywords in FMKS[] do |
(30) for to Number of Fuzzy Keywords in FMKS |
(31) AddNodeCurrentNode = new AddNode(FMKS, FMKS, TreeHeight); |
(32) if (TreeHeight == 0) then |
(33) For to RootNode. NumberofChild do |
(34) if (WFKS[] <RootNode. childrenNodeValue [].FMKS[]) |
then |
(35) break; |
(36) end if |
(37) end for // loop |
(38) else |
(39) for to RootNode. NumberofChild do |
(40) if (( == RootNode. NumberofChild) FMKS[] <RootNode. |
childrenNodeValue [].FMKS[]) then |
(41) AddNodeNewNode = InsertNodeIntoBTree (RootNode. childrenNodeValue[++].NextNode, |
FMKS[], FMKS, TreeHeight -1); |
(42) if (NewNode == NULL) then |
(43) return null; |
(44) end if |
(45) CurrentNode. FMKS[] =NewNode.childrenNodeValue. FMKS[]; |
(46) CurrentNode.NextNode = NewNode; |
(47) break; |
(48) end if |
(49) end for // loop |
(50) for to RootNode. NumberofChild do |
(51) RootNode. childrenNodeValue [] = RootNode. childrenNodeValue[]; |
(52) RootNode. childrenNodeValue [] = CurrentNode; |
(53) RootNode. NumberofChild = RootNode. NumberofChild + 1; |
(54) if (RootNode. NumberofChild < ChildLimit) then return null; |
(55) else return SplitNodeInBTree(RootNode); |
(56) end if |
(57) end for // loop |
(58) end for // loop |
(59) end for // loop |
(60) End Function AddNodeInsertNodeIntoBTree |
(61) Function SplitNodeInBTree(RootNode) |
(62) Declare the variable for processing loop |
(63) AddNodeSplitNode = new AddNode (ChildLimit/2); |
(64) RootNode. NumberofChild = ChildLimit/2; |
(65) for to ChildLimit/2 do |
(66) SplitNode. childrenNodeValue = RootNode. childrenNodeValue[childLimit/2 + ]; |
(67) return SplitNode; |
(68) end for // loop |
(69) End Function SplitNodeInBTree |