|
|
|
@ -61,8 +61,18 @@ public class BST { |
|
|
|
// of the binary search tree. |
|
|
|
public String inOrder() { |
|
|
|
// TODO: implement this method using a non-recursive solution |
|
|
|
|
|
|
|
return ""; // replace this statement with your own return |
|
|
|
String return_string = ""; |
|
|
|
BSTNode[] stack = new BSTNode[size()]; |
|
|
|
int stack_pointer = 0; |
|
|
|
BSTNode current = m_root; |
|
|
|
while (true) { |
|
|
|
while (current.getLeft() != null) { |
|
|
|
stack[stack_pointer] = current; |
|
|
|
stack_pointer++; |
|
|
|
current = current.getLeft(); |
|
|
|
} |
|
|
|
} |
|
|
|
return return_string; // replace this statement with your own return |
|
|
|
} |
|
|
|
|
|
|
|
// This method returns the smallest element in the binary search tree. You |
|
|
|
|