From b58ee52a8157d971440d6c92a194a92c2d75f83b Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Fri, 26 Nov 2021 02:25:38 +0000 Subject: (General)~forgot to format my files Need to remember to format before each commit --- btree.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'btree.cpp') diff --git a/btree.cpp b/btree.cpp index 8c32b1f..741c8f7 100644 --- a/btree.cpp +++ b/btree.cpp @@ -40,22 +40,24 @@ BinaryTree *insert(BinaryTree *tree, T value) break; } - if (*node) { + if (*node) + { *node = insert(*node, value); return tree; } - *node = new BinaryTree; + *node = new BinaryTree; (*node)->value = value; (*node)->left = (*node)->right = nullptr; - (*node)->compare = tree->compare; + (*node)->compare = tree->compare; return tree; } int main(void) { - auto tree = new BinaryTree; - tree->value = 5; - tree->compare = [](int x, int y) { + auto tree = new BinaryTree; + tree->value = 5; + tree->compare = [](int x, int y) + { if (x < y) return LT; else if (x > y) @@ -65,9 +67,7 @@ int main(void) }; for (int i = 0; i <= 5; ++i) - { tree = insert(tree, i * 2); - } std::cout << tree->left->value << ", " << tree->value << ", " -- cgit v1.2.3-13-gbd6f