|
1 | 1 | package com.thealgorithms.tree; |
2 | 2 |
|
3 | 3 | import static org.junit.jupiter.api.Assertions.assertEquals; |
4 | | -import static org.junit.jupiter.api.Assertions.assertFalse; |
5 | 4 | import static org.junit.jupiter.api.Assertions.assertTrue; |
6 | 5 |
|
7 | 6 | import org.junit.jupiter.api.BeforeEach; |
@@ -51,37 +50,6 @@ void testUpdateNodeValue() { |
51 | 50 | assertEquals(100, hld.queryMaxInPath(4, 5), "Updated value should be reflected in query"); |
52 | 51 | } |
53 | 52 |
|
54 | | - /** |
55 | | - * Tests insertion of negative values into the BST. |
56 | | - * Verifies that the tree is not empty and remains balanced. |
57 | | - */ |
58 | | - @Test |
59 | | - void testInsertNegativeValues() { |
60 | | - BinarySearchTree bst = new BinarySearchTree(); |
61 | | - int[] negativeValues = {-10, -20, -5, -15}; |
62 | | - bst.populate(negativeValues); |
63 | | - assertFalse(bst.isEmpty(), "BST should not be empty after inserting negative values"); |
64 | | - assertTrue(bst.balanced(), "BST with negative values should be balanced"); |
65 | | - } |
66 | | - |
67 | | - /** |
68 | | - * Tests insertion of duplicate values into the BST. |
69 | | - * Verifies that the tree handles duplicates (either inserts or ignores them). |
70 | | - * Note: Current BST implementation inserts duplicates to the right. |
71 | | - */ |
72 | | - @Test |
73 | | - void testInsertDuplicateValues() { |
74 | | - BinarySearchTree bst = new BinarySearchTree(); |
75 | | - int[] valuesWithDuplicates = {10, 20, 10, 30, 20}; |
76 | | - bst.populate(valuesWithDuplicates); |
77 | | - assertFalse(bst.isEmpty(), "BST should not be empty after inserting duplicates"); |
78 | | - |
79 | | - // Optional: Check structure manually via traversal |
80 | | - bst.inOrder(); // Output can be visually verified |
81 | | - assertTrue(true, "BST handled duplicate values (check logic if duplicates are allowed)"); |
82 | | - } |
83 | | - |
84 | | - |
85 | 53 | /** |
86 | 54 | * Tests the maximum value query in a skewed tree structure. |
87 | 55 | */ |
|
0 commit comments