1
1
package com .thealgorithms .datastructures .trees ;
2
2
3
- import org .junit .jupiter .api .Test ;
3
+ import static org .junit .jupiter .api .Assertions . assertEquals ;
4
4
5
5
import java .util .Collections ;
6
6
import java .util .List ;
7
7
8
- import static org .junit .jupiter .api .Assertions . assertEquals ;
8
+ import org .junit .jupiter .api .Test ;
9
9
10
10
/**
11
11
*
@@ -39,9 +39,7 @@ public void testSingleNodeTree() {
39
39
*/
40
40
@ Test
41
41
public void testCompleteBinaryTree () {
42
- final BinaryTree .Node root = TreeTestUtils .createTree (new Integer []{
43
- 1 , 2 , 3 , 4 , 5 , 6 , 7
44
- });
42
+ final BinaryTree .Node root = TreeTestUtils .createTree (new Integer [] {1 , 2 , 3 , 4 , 5 , 6 , 7 });
45
43
46
44
List <Integer > expected = List .of (1 , 2 , 4 , 5 , 6 , 7 , 3 );
47
45
@@ -64,9 +62,7 @@ public void testCompleteBinaryTree() {
64
62
*/
65
63
@ Test
66
64
public void testBoundaryTraversal () {
67
- final BinaryTree .Node root = TreeTestUtils .createTree (new Integer []{
68
- 1 , 2 , 7 , 3 , null , null , 8 , null , 4 , 9 , null , 5 , 6 , 10 , 11
69
- });
65
+ final BinaryTree .Node root = TreeTestUtils .createTree (new Integer [] {1 , 2 , 7 , 3 , null , null , 8 , null , 4 , 9 , null , 5 , 6 , 10 , 11 });
70
66
71
67
List <Integer > expected = List .of (1 , 2 , 3 , 4 , 5 , 6 , 10 , 11 , 9 , 8 , 7 );
72
68
@@ -85,7 +81,7 @@ public void testBoundaryTraversal() {
85
81
*/
86
82
@ Test
87
83
public void testLeftSkewedTree () {
88
- final BinaryTree .Node root = TreeTestUtils .createTree (new Integer []{1 , 2 , null , 3 , null , 4 , null });
84
+ final BinaryTree .Node root = TreeTestUtils .createTree (new Integer [] {1 , 2 , null , 3 , null , 4 , null });
89
85
90
86
List <Integer > expected = List .of (1 , 2 , 3 , 4 );
91
87
@@ -104,7 +100,7 @@ public void testLeftSkewedTree() {
104
100
*/
105
101
@ Test
106
102
public void testRightSkewedTree () {
107
- final BinaryTree .Node root = TreeTestUtils .createTree (new Integer []{5 , null , 6 , null , 7 , null , 8 });
103
+ final BinaryTree .Node root = TreeTestUtils .createTree (new Integer [] {5 , null , 6 , null , 7 , null , 8 });
108
104
109
105
List <Integer > expected = List .of (5 , 6 , 7 , 8 );
110
106
0 commit comments