Created
October 7, 2018 22:13
-
-
Save xnorcode/5830c0d42de49af56192a6e088fc63e6 to your computer and use it in GitHub Desktop.
Depth-First Search Pre-Order traversal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
// DSF pre-order print of all values in BST | |
static void printPreOrder(Node current){ | |
// print current node data | |
System.out.println(current.data); | |
// print left child | |
if(current.left != null) printInOrder(current.left); | |
// print right child | |
if(current.right != null) printInOrder(current.right); | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment