Skip to content

Commit 905e2d6

Browse files
committed
Add tests for construct BST from preOrder
1 parent a660cbe commit 905e2d6

1 file changed

Lines changed: 1 addition & 9 deletions

File tree

data_structures/source/test/binary_search_tree/test_binary_search_tree_from_sorted_array.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,8 @@
33
//
44
#include "gtest/gtest.h"
55
#include "../../binary_search_tree/binary_search_tree_from_sorted_array.h"
6+
#include "test_helper.h"
67

7-
template <typename T>
8-
bool is_valid_binary_search_tree(TreeNode<T>* root, TreeNode<T>* min = nullptr, TreeNode<T>* max = nullptr)
9-
{
10-
if (!root)
11-
return true;
12-
if (min != nullptr && root->value <= min->value) return false;
13-
if (max != nullptr && root->value >= max->value) return false;
14-
return is_valid_binary_search_tree(root->left, min, root) && is_valid_binary_search_tree(root->right, root, max);
15-
}
168

179
TEST(binary_search_tree_from_sorted_array, simple_array)
1810
{

0 commit comments

Comments
 (0)