Skip to content

Commit

Permalink
added DisconnectChild()
Browse files Browse the repository at this point in the history
  • Loading branch information
dangerrangerous committed May 14, 2017
1 parent 5032808 commit ab92959
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 4 deletions.
9 changes: 8 additions & 1 deletion 2-3-4_B_Tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,14 @@ void TwoThreeFourNode::ConnectChild(int childNum, TwoThreeFourNode child)
}
} // end ConnectChild()


// smelly syntax.
TwoThreeFourNode* TwoThreeFourNode::DisconnectChild(int childNum)
{
TwoThreeFourNode tempNode = *childArray[childNum];
childArray[childNum] = nullptr;

return &tempNode;
}



Expand Down
18 changes: 17 additions & 1 deletion 2-3-4_B_Tree_Project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,42 @@ int main()

DataItem dataItem2;
dataItem2.data = 5;

DataItem dataItem3;
dataItem3.data = 7;


dataItem.DisplayItem();

DataItem* dataPtr = &dataItem;

DataItem* dataPtr2 = &dataItem2;


DataItem* dataPtr3 = &dataItem3;

TwoThreeFourNode node1;
TwoThreeFourNode node2;
TwoThreeFourNode node3;

node1.InsertItem(dataPtr);
node1.InsertItem(dataPtr);


node2.InsertItem(dataPtr2);
node2.InsertItem(dataPtr3);

node3.InsertItem(dataPtr);
node3.InsertItem(dataPtr2);
node3.InsertItem(dataPtr3);

node1.DisplayNode();

node1.GetNumItems();

node1.ConnectChild(1, node2);
node2.ConnectChild(0, node3);

node2.DisconnectChild(0);


return 0;
Expand Down
Binary file modified Debug/2-3-4_B_Tree.obj
Binary file not shown.
2 changes: 0 additions & 2 deletions Debug/2-3-4_B_Tree_Project.log
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
 2-3-4_B_Tree_Project.cpp
2-3-4_B_Tree.cpp
Generating Code...
2-3-4_B_Tree_Project.vcxproj -> C:\Users\Brian\onedrive\documents\visual studio 2015\Projects\2-3-4_B_Tree_Project\Debug\2-3-4_B_Tree_Project.exe
2-3-4_B_Tree_Project.vcxproj -> C:\Users\Brian\onedrive\documents\visual studio 2015\Projects\2-3-4_B_Tree_Project\Debug\2-3-4_B_Tree_Project.pdb (Full PDB)
Binary file modified Debug/2-3-4_B_Tree_Project.obj
Binary file not shown.
Binary file modified Debug/vc140.idb
Binary file not shown.
Binary file modified Debug/vc140.pdb
Binary file not shown.

0 comments on commit ab92959

Please sign in to comment.