File tree 1 file changed +13
-12
lines changed
src/main/java/com/thealgorithms/datastructures/trees 1 file changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,19 @@ public void delete(final int key) {
86
86
root .right = temp .right ;
87
87
}
88
88
}
89
+
90
+ /**
91
+ * Perform a traversal of the SplayTree.
92
+ *
93
+ * @param traversal The type of traversal method.
94
+ * @return A list containing the keys in the specified traversal order.
95
+ */
96
+ public List <Integer > traverse (TreeTraversal traversal ) {
97
+ List <Integer > result = new LinkedList <>();
98
+ traversal .traverse (root , result );
99
+ return result ;
100
+ }
101
+
89
102
/**
90
103
* Finds the node with the maximum key in a given subtree.
91
104
*
@@ -104,18 +117,6 @@ private Node findMax(Node root) {
104
117
return root ;
105
118
}
106
119
107
- /**
108
- * Perform a traversal of the SplayTree.
109
- *
110
- * @param traversal The type of traversal method.
111
- * @return A list containing the keys in the specified traversal order.
112
- */
113
- public List <Integer > traverse (TreeTraversal traversal ) {
114
- List <Integer > result = new LinkedList <>();
115
- traversal .traverse (root , result );
116
- return result ;
117
- }
118
-
119
120
/**
120
121
* Zig operation.
121
122
*
You can’t perform that action at this time.
0 commit comments