diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2021-11-26 02:25:38 +0000 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2021-11-26 02:35:23 +0000 |
commit | b58ee52a8157d971440d6c92a194a92c2d75f83b (patch) | |
tree | 26dbc5f1e2adc7e632265f67721530eab44dac7a /btree.cpp | |
parent | 516325444fc6e109e6fcb0afc895ca6434499c53 (diff) | |
download | algorithms-b58ee52a8157d971440d6c92a194a92c2d75f83b.tar.gz algorithms-b58ee52a8157d971440d6c92a194a92c2d75f83b.tar.bz2 algorithms-b58ee52a8157d971440d6c92a194a92c2d75f83b.zip |
(General)~forgot to format my files
Need to remember to format before each commit
Diffstat (limited to 'btree.cpp')
-rw-r--r-- | btree.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -40,22 +40,24 @@ BinaryTree<T> *insert(BinaryTree<T> *tree, T value) break; } - if (*node) { + if (*node) + { *node = insert(*node, value); return tree; } - *node = new BinaryTree<T>; + *node = new BinaryTree<T>; (*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<int>; - tree->value = 5; - tree->compare = [](int x, int y) { + auto tree = new BinaryTree<int>; + 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 << ", " |